Checking for WHNF (a horrible naughty thing)
Jan-Willem Maessen
jmaessen at alum.mit.edu
Wed Nov 23 11:10:50 EST 2005
I would like to do a horrible naughty thing (which I promise never to
expose to the world). I would like to tell whether a term is in
WHNF, without forcing evaluation of that term. Something like:
isWHNF :: a -> Bool
Is there a way of doing this? I can fake it with an IORef and much
unsafeness, but I'm wondering if there's a safe-but-ugly way of doing
the test in GHC.
If you're curious, I'm trying to compact exactly the evaluated spine
of a list without changing the list's laziness in any way. It
remains to be seen whether this is even vaguely a good idea. :-)
-Jan-Willem Maessen
More information about the Glasgow-haskell-users
mailing list