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

Safe HaskellNone
LanguageHaskell2010

Generics.SOP.NFData

Description

Generic reduction to normal form.

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

Synopsis

Documentation

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