-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Deriving without spelling out "deriving" -- -- This plugin implicitly adds "deriving" clauses to all data types in a -- module. See Driving.Classes to get started. @package driving-classes-plugin @version 0.1.4.0 -- | Derive instances without spelling out "deriving". -- --

Usage

-- -- Step 1: add this pragma at the top of the file to load the -- plugin: -- --
--   {-# OPTIONS_GHC -fplugin=Driving.Classes #-}
--   
-- -- Step 2: enable DerivingStrategies and other relevant -- extensions as needed (DerivingVia, -- GeneralizedNewtypeDeriving, DeriveAnyClass): -- --
--   {-# LANGUAGE DerivingStrategies #-}
--   
-- -- Step 3: add an ANN pragma after imports to configure -- the classes to auto-derive: -- --
--   {-# ANN module (Driving :: Driving '[ <LIST OF OPTIONS> ]) #-}
--   
-- --

Example

-- -- This automatically declares instances of Eq, Ord, -- Show for T, U, V, and disables -- auto-deriving for MyEndo. -- --
--   {-# ANN module (Driving :: Driving
--     '[ Stock '(Eq, Ord, Show)
--      , NoDriving '(Eq MyEndo, Ord MyEndo, Show MyEndo)
--      ]) #-}
--   
--   data T = C1 | C2
--   data U = D1 | D2
--   data V = E1 | E2
--   
--   newtype MyEndo a = MyEndo (a -> a)
--   
-- -- Available options: -- -- -- -- See more examples below. module Driving.Classes -- | Type constructor for configuring the plugin in a source annotation. -- -- Argument: list of types using the constructors below. -- --

Example

-- --
--   {-# ANN module (Driving :: Driving '[ Stock '(Eq, Ord), Newtype Num ]) #-}
--   
data Driving :: k -> Type -- | Dummy constructor [Driving] :: Driving x -- | Auto-derive classes using the stock deriving strategy. -- -- Argument: a class (of kind k -> Constraint for some -- k), or a tuple of classes. -- --

Examples

-- --
--   {-# ANN module (Driving :: Driving '[ Stock Show ]) #-}
--   {-# ANN module (Driving :: Driving '[ Stock '(Eq, Ord) ]) #-}
--   
data Stock :: k -> Type -- | Auto-derive classes using the newtype deriving strategy. -- Enable the extension GeneralizedNewtypeDeriving to use this. -- -- Argument: a class (of kind k -> Constraint for some -- k), or a tuple of classes. -- --

Examples

-- --
--   {-# ANN module (Driving :: Driving '[ Newtype Num ]) #-}
--   {-# ANN module (Driving :: Driving '[ Newtype '(Semigroup, Monoid)]) #-}
--   
data Newtype :: k -> Type -- | Auto-derive classes using the anyclass deriving strategy. -- Enable the extension DeriveAnyClass to use this. -- -- Argument: a class (of kind k -> Constraint for some -- k), or a tuple of classes. -- --

Examples

-- --
--   {-# ANN module (Driving :: Driving '[ Anyclass Binary ]) #-}
--   {-# ANN module (Driving :: Driving '[ Anyclass '(ToJSON, FromJSON) ]) #-}
--   -- Classes from the packages binary and aeson
--   
data Anyclass :: k -> Type -- | Auto-derive classes using the via deriving strategy, for a -- given via-type. Enable the extension DerivingVia to use this. -- -- Arguments: -- --
    --
  1. a class (of kind k -> Constraint for some k), -- or a tuple of classes;
  2. --
  3. a type.
  4. --
-- --

Examples

-- --
--   {-# ANN module (Driving :: Driving '[ Num `Via` Int ]) #-}
--   {-# ANN module (Driving :: Driving '[ '(Eq, Ord) `Via` Int ]) #-}
--   
data Via :: k -> l -> Type -- | Auto-derive classes using the via deriving strategy, where -- the via-type is an application of a given type constructor to each -- newly declared type. Enable the extension DerivingVia to use -- this. -- -- Arguments: -- --
    --
  1. a class (of kind k -> Constraint for some k), -- or a tuple of classes;
  2. --
  3. a type constructor.
  4. --
-- --

Examples

-- --
--   {-# ANN module (Driving :: Driving '[ '(Functor, Applicative) `ViaF` WrappedMonad ]) #-}
--   {-# ANN module (Driving :: Driving '[ '(Semigroup, Monoid) `ViaF` Generically ]) #-}
--   -- Generically from the package generic-data
--   
data ViaF :: k -> l -> Type -- | Cancel auto-deriving for a particular instance. -- -- Argument: an application of a class to a type, or a tuple of those. -- --

Example

-- -- Derive Show for all types except MyType: -- --
--   {-# ANN module (Driving :: Driving '[ Stock Show, NoDriving (Show MyType) ]) #-}
--   
data NoDriving :: k -> Type -- | For the compiler. plugin :: Plugin instance forall k (a :: k). (Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable k) => Data.Data.Data (Driving.Classes.Driving a)