[Haskell] Re: type class instance selection & search

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Wed Aug 1 09:41:33 EDT 2007

Am Mittwoch, 1. August 2007 14:41 schrieb apfelmus:
> […]

> The problem with the Functor/Cofunctor instances is that they are
> ambiguous as soon as a type constructor  X  is made an instance of both
>  Functor  and  Cofunctor . Of course, such an  X  cannot exist in a
> mathematically useful way (really ?)

I think, it can:

    newtype Const a b = MkConst a

    instance Functor (Const a) where

        fmap fun (MkConst a) = MkConst a

    instance Cofunctor (Const a) where

        cofmap fun (MkConst a) = MkConst a

> […]

Best wishes,

More information about the Haskell mailing list