Skip to content

rnf should work for any value or rnf should be implemented in the compiler

Currently rnf is implemented in a type class NFData in Control.Parallel.Strategies. This is not general enough, since it doesn't work for values that only exist in a monad. E.g. something built in the ST monad that uses unsafeInterleaveST cannot be converted to head normal form via rnf, since it cannot return a "Done" value, only a ST s Done value.

A solution would be to have the function rnf implemented in the compiler. Its specification would be to evaluate its argument to head normal form and then return it. This is much more convenient to users, since they don't need to implement the boiler-plate code for every data type encountered.

Trac metadata
Trac field Value
Version 6.7
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information