úÎ&T%!GHCstable$Herbert Valerio Riedel <hvr@gnu.org> Safe-Inferred Variant of  supporting   Hidden internal type-class  Note: the   instance is not provided for  in order to # trigger a compile-time error; see  which defers this to  a runtime error.  GHC.Generics-based  implementation This provides a generic " implementation for one type at a  time. If the type of the value  is asked to reduce to @ NF contains values of other types, those types have to provide  : instances. This also means that recursive types can only  be used with  if a  instance has been defined  as well (see examples below). The typical usage for " is for reducing boilerplate code  when defining " instances for ordinary algebraic ? datatypes. See the code below for some simple usage examples:   {-# LANGUAGE DeriveGeneric #-}   import Control.DeepSeq . import Control.DeepSeq.Generics (genericRnf)  import GHC.Generics   -- simple record ' data Foo = Foo AccountId Name Address  deriving Generic   type Address = [String]  type Name = String # newtype AccountId = AccountId Int   instance NFData AccountId , instance NFData Foo where rnf = genericRnf   -- recursive list-like type # data N = Z | S N deriving Generic  * instance NFData N where rnf = genericRnf   -- parametric & recursive type + data Bar a = Bar0 | Bar1 a | Bar2 (Bar a)  deriving Generic  < instance NFData a => NFData (Bar a) where rnf = genericRnf  Note: The 0 type-class showing up in the type-signature is > used internally and not exported on purpose currently.  Variant of 2 which supports derivation for uninhabited types. For instance, the type   data TagFoo deriving Generic &would cause a compile-time error with  , but with  $ the error is deferred to run-time:  + Prelude> genericRnf (undefined :: TagFoo)   <interactive>:1:1: E No instance for (GNFData V1) arising from a use of `genericRnf' @ Possible fix: add an instance declaration for (GNFData V1) 9 In the expression: genericRnf (undefined :: TagFoo) D In an equation for `it': it = genericRnf (undefined :: TagFoo)  - Prelude> genericRnfV1 (undefined :: TagFoo) \ *** Exception: Control.DeepSeq.Generics.genericRnfV1: NF not defined for uninhabited types Since: 0.1.1.0           deepseq-generics-0.1.1.0Control.DeepSeq.Genericsdeepseq-1.3.0.1Control.DeepSeqforce$!!deepseqrnfNFData genericRnf genericRnfV1 GNFDataV1GNFDatabase GHC.GenericsV1grnfV1_grnf_$fGNFDataV1:+:$fGNFDataV1:*: $fGNFDataV1M1 $fGNFDataV1K1 $fGNFDataV1U1 $fGNFDataV1V1 $fGNFData:+: $fGNFData:*: $fGNFDataM1 $fGNFDataK1 $fGNFDataU1