On Dec 14, 2007 4:18 PM, Felipe Lessa <felipe.lessa@gmail.com> wrote:

If it is not, the implementation "fmap f = id" is really the only one sound,
right?

It pretty clear what you meant here, but it's worth noting that "fmap f = id" is a type error.

Consider:

    id :: a -> a
    (\Val i -> Val i) :: Val a -> Val b

These can (and, if Val is a newtype, will) be compiled to the same code, but they don't have the same type. In particular, there is no way to unify "a -> a" with "f a -> f b" for any f.

And yes, I'm pretty sure that's the only possible implementation for that type which satisfies the functor laws.

--
Dave Menendez < dave@zednenem.com>
<http://www.eyrie.org/~zednenem/>