
16 Dec
2007
16 Dec
'07
5:29 a.m.
On 16 Dec 2007, at 2:23 AM, Dominic Steinitz wrote:
keep in mind that Haskell "composition" (.) is not really composition in the category-theoretic sense, because it adds extra laziness. Use this
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) which /= bot since (seq bot () = bot) but (seq (\ x -> M) () = ()) regardless of what expression we substitute for M. jcc