Re: [Haskell-cafe] Questions about the Functor class and it's use in "Data types à la carte"
dominic.steinitz at blueyonder.co.uk
Sun Dec 16 06:21:20 EST 2007
>> Do you have a counter-example of (.) not being function composition in
>> the categorical sense?
> Let bot be the function defined by
> bot :: alpha -> beta
> bot = bot
> By definition,
> (.) = \ f -> \ g -> \ x -> f (g x)
> bot . id
> = ((\ f -> \ g -> \ x -> f (g x)) bot) id
> = (\ g -> \ x -> bot (g x)) id
> = \ x -> bot (g x)
I didn't follow the reduction here. Shouldn't id replace g everywhere?
This would give
= \x -> bot x
and by eta reduction
> which /= bot since (seq bot () = bot) but (seq (\ x -> M) () = ())
> regardless of what expression we substitute for M.
Why is seq introduced?
More information about the Haskell-Cafe