
14 Dec
2007
14 Dec
'07
9:44 p.m.
On Dec 15, 2007 3:15 AM, Ryan Ingram
On 12/14/07, David Menendez
wrote: And yes, I'm pretty sure that's the only possible implementation for that type which satisfies the functor laws.
Lets just prove it, then; I'm pretty sure it comes pretty easily from the free theorem for the type of fmap.
...
Now, first note that since we cannot make any choices based on the type of f, there's no way for f to be relevant to the result of fmap; we have no way to get something of type "a" besides _|_ to pass to f, and no use for things of type "b".
Hmmm. Something about that ticks off my "don't play fast and loose with bottom" detector. data Val a = Val Int instance Functor Val where fmap f (Val x) = f `seq` Val x :-) - Benja