haskell / deepseq

Deep evaluation of data structures
http://hackage.haskell.org/package/deepseq
Other
40 stars 29 forks source link

Optimizing negations #89

Open treeowl opened 1 year ago

treeowl commented 1 year ago

If we have f :: b -> Void and g :: a -> b, we can get f . g :: a -> Void. But if we do this recursively, we'll get closures of increasing size. Would it make sense to offer something like this?

compNeg :: NFData a => (b -> Void) -> (a -> b) -> a -> Void
compNeg _ _ a = a `deepseq` error "Weird NFData instance or something"