-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Provides Template Haskell deriver for NFData instances -- -- Provides a Template Haskell based mechanism for deriving NFData -- instances for custom data types. See documentation in -- Control.DeepSeq.TH for more information. @package deepseq-th @version 0.0.0.0 module Control.DeepSeq.TH -- | Derive NFData instance for simple Data-declarations -- -- Example usage for deriving NFData instance for the type -- TypeName: -- --
--   $(deriveNFData ''TypeName)
--   
-- -- The derivation tries to avoid evaluation of strict fields whose types -- have the WHNF=NF property (see also whnfIsNf). For instance, -- consider the following type Foo: -- --
--   data Foo a = Foo1
--              | Foo2 !Int !String
--              | Foo3 (Foo a)
--              | Foo4 { fX :: Int, fY :: Char }
--              | Foo a :--: !Bool
--   
-- -- By invoking $(deriveNFData ''Foo) the generated NFData -- instance will be equivalent to: -- --
--   instance NFData a => NFData (Foo a) where
--       rnf Foo1       = ()
--       rnf (Foo2 _ x) = x `deepseq` ()
--       rnf (Foo3 x)   = x `deepseq` ()
--       rnf (Foo4 x y) = x `deepseq` y `deepseq` ()
--       rnf (x :--: _) = x `deepseq` ()
--   
-- -- Known issues/limitations: -- -- deriveNFData :: Name -> Q [Dec] -- | Plural version of deriveNFData -- -- Convenience wrapper for deriveNFData which allows to derive -- multiple NFData instances for a list of TypeNames, -- e.g.: -- --
--   $(deriveNFData [''TypeName1, ''TypeName2, ''TypeName3])
--   
deriveNFDatas :: [Name] -> Q [Dec] -- | Try to infer whether type has the property that WHNF=NF for its -- values. -- -- A result of Nothing means it is not known whether the -- property holds for the given type. Just True means that the -- property holds. -- -- This function has currently a very limited knowledge and returns -- Nothing most of the time except for some primitive types. whnfIsNf :: Type -> Maybe Bool