f `unamb` g just needs f or g to be in weak head normal form I think. This should be much easier to test for I guess.

I always confuse weak head normal form with reduced head normal form, but the documentation of GHC does not help here:

E.g.:
-- | Reduces its argument to weak head normal form.
rwhnf :: Strategy a 
rwhnf x = x `seq` ()  
but the documentation of seq says
seq :: a -> b -> b Source
Evaluates its first argument to head normal form, and then returns its second argument as the result.

Furthermore:
rnf :: Strategy a Source
Reduces its argument to (head) normal form.

So from the documentation rnf should be like seq, but it is not, rnf is a "deep seq". 
I find this very confusing. Is the documentation of seq wrong (should be weak head normal form)?
Anyway, so I guess we would actually need a function:

iswhnf  :: a -> IO Bool

But since the value of this iswhnf function depends on when it is called, I feel it has to be in the IO monad; actually multiple threads evaluating it have nothing to do with it?


On Mon, Apr 20, 2009 at 10:05 PM, Jake McArthur <jake.mcarthur@gmail.com> wrote:
Christopher Lane Hinson wrote:
What we'd like to avoid is duplicate verification that a thunk is hnf. Do we have evidence that this verification ever actually consumes a lot of resources?

I think the OP is trying to avoid spawning unnecessary threads at the cost of duplicate checks for HNF.

- Jake