[Haskell-beginners] several questions: multi-param typeclasses, etc.

Chaddaï Fouché chaddai.fouche at gmail.com
Sun Nov 1 14:21:11 EST 2009


On Sun, Nov 1, 2009 at 5:32 PM, Michael Mossey <mpm at alumni.caltech.edu> wrote:
> On the other hand, if you added
>
> instance (Error e) => MonadError String (Either e)
>
> and didn't include the functional dependency, the compiler would still run
> into a problem with overlapping instances and have no way to decide, which I
> presume is still an error.

Right, in this case it is true, but supposing the MonadError instance
for Either was rather :

> instance (Error e) => MonadError (Maybe String) (Either e)

There would be nothing a priori that would prevent you from writing
another instance :

> instance (Error e) => MonadError String (Either e)

There are a certain number of case where this functional constraint is
thus useful.

-- 
Jedaï


More information about the Beginners mailing list