
5 Jan
2010
5 Jan
'10
4:15 p.m.
Brent Yorgey wrote:
On Mon, Jan 04, 2010 at 11:49:33PM +0100, Steffen Schuldenzucker wrote:
[...]
As others have pointed out, this doesn't typecheck; but what it DOES show is that if we had a type class
class Endofunctor a where efmap :: (a -> a) -> f a -> f a
then it would be possible to write an instance for which efmap id = id but efmap (f . g) /= efmap f . efmap g. The difference is that with the normal Functor class, once you have applied your function f :: a -> b to get a b, you can't do anything else with it, since you don't know what b is. With the Endofunctor class, once you have applied f :: a -> a, you CAN do something with the result: namely, apply f again.
Oops. Yeah, sorry, it's been ... late and stuff... Steffen