[Haskell-beginners] Custom type classes

Guillaume Bouchard guillaum.bouchard+haskell at gmail.com
Wed Jan 27 13:28:55 UTC 2016


On Wed, Jan 27, 2016 at 11:11 AM, Imants Cekusins <imantc at gmail.com> wrote:
>> `fmap` types mean that `a` should be anything, and not something
> constrained.
>
> just wondering: is it something specific to Functor class or does this
> hold for any class declaration:
>
> (a -> b)
> is not the same as
> ... a => (a -> b)

a => (a -> b) does not really mean anything as far as I know because a
is not a constraint (i.e: a typeclass).

Perhaps you mean something such as

Constraint a => (a -> b)

> in other words, if class expects (a -> b) with any a, instance must
> not constrain a.

However I discovered the `ConstraintKinds` extension which may improve
the situation.

-- 
G.


More information about the Beginners mailing list