-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Backports of GHC deriving extensions -- -- Provides Template Haskell functions that mimic deriving extensions -- that were introduced or modified in recent versions of GHC. Currently, -- the following typeclasses/extensions are covered: -- --
DeriveFoldable
DeriveFunctor
DeriveTraversable
DeriveDataTypeable
-- newtype Foo a = MkFoo a -- $(deriveGND [t| forall a. Eq a => Eq (Foo a) |]) --deriveGND :: Q Type -> Q [Dec] -- | Generates an instance for a type class by emulating the behavior of -- the DerivingVia extension. For example: -- --
-- newtype Foo a = MkFoo a -- $(deriveVia [t| forall a. Ord a => Ord (Foo a) `Via` Down a |]) ---- -- As shown in the example above, the syntax is a tad strange. One must -- specify the type by which to derive the instance using the Via -- type. This requirement is in place to ensure that the type variables -- are scoped correctly across all the types being used (e.g., to make -- sure that the same a is used in Ord a, -- Ord (Foo a), and Down a). deriveVia :: Q Type -> Q [Dec] -- | A type-level modifier intended to be used in conjunction with -- deriveVia. Refer to the documentation for deriveVia -- for more details. data a `Via` b -- | Exports functions to mechanically derive Enum instances. module Data.Enum.Deriving -- | Generates an Enum instance declaration for the given data type -- or data family instance. deriveEnum :: Name -> Q [Dec] -- | Generates a lambda expression which behaves like succ (without -- requiring an Enum instance). makeSucc :: Name -> Q Exp -- | Generates a lambda expression which behaves like pred (without -- requiring an Enum instance). makePred :: Name -> Q Exp -- | Generates a lambda expression which behaves like toEnum -- (without requiring an Enum instance). makeToEnum :: Name -> Q Exp -- | Generates a lambda expression which behaves like fromEnum -- (without requiring an Enum instance). makeFromEnum :: Name -> Q Exp -- | Generates a lambda expression which behaves like enumFrom -- (without requiring an Enum instance). makeEnumFrom :: Name -> Q Exp -- | Generates a lambda expression which behaves like enumFromThen -- (without requiring an Enum instance). makeEnumFromThen :: Name -> Q Exp -- | Exports functions to mechanically derive Eq, Eq1, and -- Eq2 instances. module Data.Eq.Deriving -- | Generates an Eq instance declaration for the given data type or -- data family instance. deriveEq :: Name -> Q [Dec] -- | Generates a lambda expression which behaves like '(==)' (without -- requiring an Eq instance). makeEq :: Name -> Q Exp -- | Generates a lambda expression which behaves like '(/=)' (without -- requiring an Eq instance). makeNotEq :: Name -> Q Exp -- | Generates an Eq1 instance declaration for the given data type -- or data family instance. deriveEq1 :: Name -> Q [Dec] -- | Generates a lambda expression which behaves like liftEq -- (without requiring an Eq1 instance). -- -- This function is not available with transformers-0.4. makeLiftEq :: Name -> Q Exp -- | Generates a lambda expression which behaves like eq1 (without -- requiring an Eq1 instance). makeEq1 :: Name -> Q Exp -- | Generates an Eq2 instance declaration for the given data type -- or data family instance. -- -- This function is not available with transformers-0.4. deriveEq2 :: Name -> Q [Dec] -- | Generates a lambda expression which behaves like liftEq2 -- (without requiring an Eq2 instance). -- -- This function is not available with transformers-0.4. makeLiftEq2 :: Name -> Q Exp -- | Generates a lambda expression which behaves like eq2 (without -- requiring an Eq2 instance). -- -- This function is not available with transformers-0.4. makeEq2 :: Name -> Q Exp -- | Exports functions to mechanically derive Functor instances. -- -- For more info on how deriving Functor works, see this GHC -- wiki page. module Data.Functor.Deriving -- | Generates a Functor instance declaration for the given data -- type or data family instance. deriveFunctor :: Name -> Q [Dec] -- | Like deriveFunctor, but takes an FFTOptions argument. deriveFunctorOptions :: FFTOptions -> Name -> Q [Dec] -- | Generates a lambda expression which behaves like fmap (without -- requiring a Functor instance). makeFmap :: Name -> Q Exp -- | Like makeFmap, but takes an FFTOptions argument. makeFmapOptions :: FFTOptions -> Name -> Q Exp -- | Options that further configure how the functions in -- Data.Functor.Deriving should behave. (FFT stands for -- 'Functor'/'Foldable'/'Traversable'.) newtype FFTOptions FFTOptions :: Bool -> FFTOptions -- | If True, derived instances for empty data types (i.e., ones -- with no data constructors) will use the EmptyCase language -- extension. If False, derived instances will simply use -- seq instead. (This has no effect on GHCs before 7.8, since -- EmptyCase is only available in 7.8 or later.) [fftEmptyCaseBehavior] :: FFTOptions -> Bool -- | Conservative FFTOptions that doesn't attempt to use -- EmptyCase (to prevent users from having to enable that -- extension at use sites.) defaultFFTOptions :: FFTOptions -- | Exports functions to mechanically derive Foldable instances in -- a way that mimics how the -XDeriveFoldable extension works -- since GHC 8.0. -- -- These changes make it possible to derive Foldable instances -- for data types with existential constraints, e.g., -- --
-- data WrappedSet a where -- WrapSet :: Ord a => a -> WrappedSet a -- -- deriving instance Foldable WrappedSet -- On GHC 8.0 on later -- $(deriveFoldable ''WrappedSet) -- On GHC 7.10 and earlier ---- -- In addition, derived Foldable instances from this module do not -- generate superfluous mempty expressions in its implementation -- of foldMap. One can verify this by compiling a module that uses -- deriveFoldable with the -ddump-splices GHC flag. -- -- For more info on these changes, see this GHC wiki page. module Data.Foldable.Deriving -- | Generates a Foldable instance declaration for the given data -- type or data family instance. deriveFoldable :: Name -> Q [Dec] -- | Like deriveFoldable, but takes an FFTOptions argument. deriveFoldableOptions :: FFTOptions -> Name -> Q [Dec] -- | Generates a lambda expression which behaves like foldMap -- (without requiring a Foldable instance). makeFoldMap :: Name -> Q Exp -- | Like makeFoldMap, but takes an FFTOptions argument. makeFoldMapOptions :: FFTOptions -> Name -> Q Exp -- | Generates a lambda expression which behaves like foldr (without -- requiring a Foldable instance). makeFoldr :: Name -> Q Exp -- | Like makeFoldr, but takes an FFTOptions argument. makeFoldrOptions :: FFTOptions -> Name -> Q Exp -- | Generates a lambda expression which behaves like fold -- (without requiring a Foldable instance). makeFold :: Name -> Q Exp -- | Like makeFold, but takes an FFTOptions argument. makeFoldOptions :: FFTOptions -> Name -> Q Exp -- | Generates a lambda expression which behaves like foldl (without -- requiring a Foldable instance). makeFoldl :: Name -> Q Exp -- | Like makeFoldl, but takes an FFTOptions argument. makeFoldlOptions :: FFTOptions -> Name -> Q Exp -- | Options that further configure how the functions in -- Data.Functor.Deriving should behave. (FFT stands for -- 'Functor'/'Foldable'/'Traversable'.) newtype FFTOptions FFTOptions :: Bool -> FFTOptions -- | If True, derived instances for empty data types (i.e., ones -- with no data constructors) will use the EmptyCase language -- extension. If False, derived instances will simply use -- seq instead. (This has no effect on GHCs before 7.8, since -- EmptyCase is only available in 7.8 or later.) [fftEmptyCaseBehavior] :: FFTOptions -> Bool -- | Conservative FFTOptions that doesn't attempt to use -- EmptyCase (to prevent users from having to enable that -- extension at use sites.) defaultFFTOptions :: FFTOptions -- | Exports functions to mechanically derive Ix instances. module Data.Ix.Deriving -- | Generates a Ix instance declaration for the given data type -- or data family instance. deriveIx :: Name -> Q [Dec] -- | Generates a lambda expression which behaves like range -- (without requiring an Ix instance). makeRange :: Name -> Q Exp -- | Generates a lambda expression which behaves like unsafeIndex -- (without requiring an Ix instance). makeUnsafeIndex :: Name -> Q Exp -- | Generates a lambda expression which behaves like inRange -- (without requiring an Ix instance). makeInRange :: Name -> Q Exp -- | Exports functions to mechanically derive Ord, Ord1, -- and Ord2 instances. module Data.Ord.Deriving -- | Generates an Ord instance declaration for the given data type -- or data family instance. deriveOrd :: Name -> Q [Dec] -- | Generates a lambda expression which behaves like compare -- (without requiring an Ord instance). makeCompare :: Name -> Q Exp -- | Generates a lambda expression which behaves like '(<)' (without -- requiring an Ord instance). makeLT :: Name -> Q Exp -- | Generates a lambda expression which behaves like '(<=)' (without -- requiring an Ord instance). makeLE :: Name -> Q Exp -- | Generates a lambda expression which behaves like '(>)' (without -- requiring an Ord instance). makeGT :: Name -> Q Exp -- | Generates a lambda expression which behaves like '(>=)' (without -- requiring an Ord instance). makeGE :: Name -> Q Exp -- | Generates a lambda expression which behaves like max (without -- requiring an Ord instance). makeMax :: Name -> Q Exp -- | Generates a lambda expression which behaves like min (without -- requiring an Ord instance). makeMin :: Name -> Q Exp -- | Generates an Ord1 instance declaration for the given data type -- or data family instance. deriveOrd1 :: Name -> Q [Dec] -- | Generates a lambda expression which behaves like liftCompare -- (without requiring an Ord1 instance). -- -- This function is not available with transformers-0.4. makeLiftCompare :: Name -> Q Exp -- | Generates a lambda expression which behaves like compare1 -- (without requiring an Ord1 instance). makeCompare1 :: Name -> Q Exp -- | Generates an Ord2 instance declaration for the given data type -- or data family instance. -- -- This function is not available with transformers-0.4. deriveOrd2 :: Name -> Q [Dec] -- | Generates a lambda expression which behaves like liftCompare2 -- (without requiring an Ord2 instance). -- -- This function is not available with transformers-0.4. makeLiftCompare2 :: Name -> Q Exp -- | Generates a lambda expression which behaves like compare2 -- (without requiring an Ord2 instance). -- -- This function is not available with transformers-0.4. makeCompare2 :: Name -> Q Exp -- | Exports functions to mechanically derive Traversable instances -- in a way that mimics how the -XDeriveTraversable extension -- works since GHC 8.0. -- -- Derived Traversable instances from this module do not generate -- superfluous pure expressions in its implementation of -- traverse. One can verify this by compiling a module that uses -- deriveTraversable with the -ddump-splices GHC flag. -- -- These changes make it possible to derive Traversable -- instances for data types with unlifted argument types, e.g., -- --
-- data IntHash a = IntHash Int# a -- -- deriving instance Traversable IntHash -- On GHC 8.0 on later -- $(deriveTraversable ''IntHash) -- On GHC 7.10 and earlier ---- -- For more info on these changes, see this GHC wiki page. module Data.Traversable.Deriving -- | Generates a Traversable instance declaration for the given data -- type or data family instance. deriveTraversable :: Name -> Q [Dec] -- | Like deriveTraverse, but takes an FFTOptions argument. deriveTraversableOptions :: FFTOptions -> Name -> Q [Dec] -- | Generates a lambda expression which behaves like traverse -- (without requiring a Traversable instance). makeTraverse :: Name -> Q Exp -- | Like makeTraverse, but takes an FFTOptions argument. makeTraverseOptions :: FFTOptions -> Name -> Q Exp -- | Generates a lambda expression which behaves like sequenceA -- (without requiring a Traversable instance). makeSequenceA :: Name -> Q Exp -- | Like makeSequenceA, but takes an FFTOptions argument. makeSequenceAOptions :: FFTOptions -> Name -> Q Exp -- | Generates a lambda expression which behaves like mapM (without -- requiring a Traversable instance). makeMapM :: Name -> Q Exp -- | Like makeMapM, but takes an FFTOptions argument. makeMapMOptions :: FFTOptions -> Name -> Q Exp -- | Generates a lambda expression which behaves like sequence -- (without requiring a Traversable instance). makeSequence :: Name -> Q Exp -- | Like makeSequence, but takes an FFTOptions argument. makeSequenceOptions :: FFTOptions -> Name -> Q Exp -- | Options that further configure how the functions in -- Data.Functor.Deriving should behave. (FFT stands for -- 'Functor'/'Foldable'/'Traversable'.) newtype FFTOptions FFTOptions :: Bool -> FFTOptions -- | If True, derived instances for empty data types (i.e., ones -- with no data constructors) will use the EmptyCase language -- extension. If False, derived instances will simply use -- seq instead. (This has no effect on GHCs before 7.8, since -- EmptyCase is only available in 7.8 or later.) [fftEmptyCaseBehavior] :: FFTOptions -> Bool -- | Conservative FFTOptions that doesn't attempt to use -- EmptyCase (to prevent users from having to enable that -- extension at use sites.) defaultFFTOptions :: FFTOptions -- | Exports functions to mechanically derive Read, Read1, -- and Read2 instances. module Text.Read.Deriving -- | Generates a Read instance declaration for the given data type -- or data family instance. deriveRead :: Name -> Q [Dec] -- | Like deriveRead, but takes a ReadOptions argument. deriveReadOptions :: ReadOptions -> Name -> Q [Dec] -- | Generates a lambda expression which behaves like readsPrec -- (without requiring a Read instance). makeReadsPrec :: Name -> Q Exp -- | Generates a lambda expression which behaves like readPrec -- (without requiring a Read instance). makeReadPrec :: Name -> Q Exp -- | Generates a Read1 instance declaration for the given data type -- or data family instance. deriveRead1 :: Name -> Q [Dec] -- | Like deriveRead1, but takes a ReadOptions argument. deriveRead1Options :: ReadOptions -> Name -> Q [Dec] -- | Generates a lambda expression which behaves like -- liftReadsPrec (without requiring a Read1 instance). -- -- This function is not available with transformers-0.4. makeLiftReadsPrec :: Name -> Q Exp -- | Generates a lambda expression which behaves like liftReadPrec -- (without requiring a Read1 instance). -- -- This function is only available with base-4.10 or later. makeLiftReadPrec :: Name -> Q Exp -- | Generates a lambda expression which behaves like readPrec1 -- (without requiring a Read1 instance). -- -- This function is only available with base-4.10 or later. makeReadPrec1 :: Name -> Q Exp -- | Generates a lambda expression which behaves like readsPrec1 -- (without requiring a Read1 instance). makeReadsPrec1 :: Name -> Q Exp -- | Generates a Read2 instance declaration for the given data type -- or data family instance. -- -- This function is not available with transformers-0.4. deriveRead2 :: Name -> Q [Dec] -- | Like deriveRead2, but takes a ReadOptions argument. -- -- This function is not available with transformers-0.4. deriveRead2Options :: ReadOptions -> Name -> Q [Dec] -- | Generates a lambda expression which behaves like -- liftReadsPrec2 (without requiring a Read2 instance). -- -- This function is not available with transformers-0.4. makeLiftReadsPrec2 :: Name -> Q Exp -- | Generates a lambda expression which behaves like -- liftReadPrec2 (without requiring a Read2 instance). -- -- This function is only available with base-4.10 or later. makeLiftReadPrec2 :: Name -> Q Exp -- | Generates a lambda expression which behaves like readPrec2 -- (without requiring a Read2 instance). -- -- This function is only available with base-4.10 or later. makeReadPrec2 :: Name -> Q Exp -- | Generates a lambda expression which behaves like readsPrec2 -- (without requiring a Read2 instance). -- -- This function is not available with transformers-0.4. makeReadsPrec2 :: Name -> Q Exp -- | Options that further configure how the functions in -- Text.Read.Deriving should behave. newtype ReadOptions ReadOptions :: Bool -> ReadOptions -- | If True: -- --