[Haskell-cafe] Re: instance Eq (a -> b)

Thomas Davie tom.davie at gmail.com
Wed Apr 14 04:35:09 EDT 2010


On 14 Apr 2010, at 09:31, Ashley Yakeley wrote:

> On Wed, 2010-04-14 at 09:29 +0100, Thomas Davie wrote:
>> It isn't?
>> 
>> fPrelude> fmap id (undefined :: IO ())
>> *** Exception: Prelude.undefined
> 
> ghci is helpfully running the IO action for you. Try this:
> 
> seq (fmap id (undefined :: IO ())) "not bottom"

Ah, rubbish...

I guess this further reinforces my point though – we have a mixture of places where we consider _|_ when considering laws, and places where we don't consider _|_.  This surely needs better defined somewhere.

For reference, the fmap on tuples which ignores the bottom case for the sake of the laws is useful :(.

Bob


More information about the Haskell-Cafe mailing list