Dean Herington wrote:

>> deepSeq :: DeepSeq a => a -> b -> b

I should point out that deepSeq with this type is the composition of two simpler operations:

   deepSeq = seq . eval where eval :: DeepSeq a => a -> a

eval ties a demand for a value to a demand for all its subvalues, while seq ties a demand for a value to a demand for another value of an unrelated type.

Of course you can define eval x = x `deepSeq` x instead, so it's largely a matter of taste.

>>  instance  DeepSeq (IO a)  where  deepSeq = seq

This is an interesting instance (which is not to say I think it's wrong). It means the original poster's code won't work. He wanted to write

   foo <- eval makeFoo `catch` \e -> defaultFoo

but makeFoo has a monadic type, so eval makeFoo === makeFoo.

-- Ben

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to