Skip to content

Instantly share code, notes, and snippets.

@ekmett
Created June 28, 2010 22:17
Show Gist options
  • Select an option

  • Save ekmett/456448 to your computer and use it in GitHub Desktop.

Select an option

Save ekmett/456448 to your computer and use it in GitHub Desktop.
RNF once
import Control.Parallel.Strategies
data NF a = NF () a
nfBy :: Strategy a -> a -> NF a
nfBy s a0 = r where r@(NF _ a) = NF (s a) a0
nf :: NFData a => a -> NF a
nf = nfBy rnf
instance NFData (NF a) where
rnf (NF s _) = s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment