Dominic Steinitz wrote:
Roberto Zunino wrote:
This is the point: eta does not hold if seq exists.
undefined `seq` 1 == undefined
(\x -> undefined x) `seq` 1 == 1
Ok I've never used seq and I've never used unsavePerformIO. Provided my
program doesn't contain these then can I assume that eta reduction holds
and that (.) is categorical composition?
Yes, provided that you do not use seq and all its related stuff, e.g.
($!), foldl', bang patterns, data Foo a = Foo !a, ...
Also, note that you still can define and use seq restricted to many
useful types:
seqInt :: Int -> a -> a
seqInt 0 x = x
seqInt _ x = x
IIRC, you can also have a quite general
seqData :: Data a => a -> b -> b
The "(.) does not form a category" argument should be something like:
id . undefined == (\x -> id (undefined x)) /= undefined
where the last inequation is due to the presence of seq. That is,
without seq, there is no way to distinguish between undefined and (const
undefined), so you could use a semantic domain where they coincide. In
that case, eta does hold.
It would be a pretty odd semantic domain where 1 == undefined. Or
perhaps, I should say not a very useful one.
in the new domain, you do not have 1 == undefined (which are still
different) but merely
undefined == (\x -> undefined)
Regards,
Zun.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe