
16 Dec
2007
16 Dec
'07
6:21 a.m.
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)
Then
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 = bot
which /= bot since (seq bot () = bot) but (seq (\ x -> M) () = ()) regardless of what expression we substitute for M.
Why is seq introduced?