Re: [Haskell-cafe] Questions about the Functor class and it's use in "Data types à la carte"

Felipe Lessa felipe.lessa at gmail.com
Fri Dec 14 16:18:51 EST 2007


On Dec 14, 2007 6:37 PM, Benja Fallenstein <benja.fallenstein at gmail.com> wrote:
> such that the following two properties hold:
>
>     * F(idX) = idF(X) for every object X in C
>     * F(g . f) = F(g) . F(f) for all morphisms f:X -> Y and g:Y -> Z."

Should we write

instance Functor Val where
  fmap = undefined

Would those properties be satisfied? Of course,

fmap (g . f) == _|_ == fmap g . fmap f,

but

fmap id x == _|_ =/= x == id x.

As my understanding of the relationship between bottoms and
non-bottoms isn't that great, could anyone tell me if the above
instance is sound (i.e. satisfy the expected properties)? If it is
not, the implementation "fmap f = id" is really the only one sound,
right?

Thanks!

-- 
Felipe.


More information about the Haskell-Cafe mailing list