basic-sop- Basic examples and functions for generics-sop

Safe HaskellNone



Generic reduction to normal form.

This module contains a generic function that reduces a value to normal form, defined using generics-sop.



grnf :: (Generic a, All2 NFData (Code a)) => a -> ()Source

Generic reduction to normal form.

This function is a generic implementation of the rnf function that can be used to instantiate the NFData class in deepseq.

Assuming you have a Generic instance for your datatype T, you can use grnf as follows:

 instance NFData T where
   rnf = grnf