[Haskell-cafe] another instance of MonadError

Corentin Dupont corentin.dupont at gmail.com
Mon Jul 18 13:01:55 UTC 2016


I could also do my own MonadError class also, no?
However this doesn't work:


 {-# LANGUAGE ConstraintKinds #-}

type EvError a = MonadError String a

class (Typeable n, Monad n, Applicative n, EvError n) => EvMgt n where ...

instance EvMgt IO where...


How can I create a new class "EvError" that inherits all the functions of
"MonadError String"?


On Fri, Jul 15, 2016 at 12:24 AM, David Feuer <david.feuer at gmail.com> wrote:

> You can't do that; sorry. You can always turn a string into an IOException
> if you like. Or you could write a wrapper around IO. But MonadError has a
> functional dependency, so you can only have one error type per monad.
>
> On Jul 14, 2016 6:19 PM, "Corentin Dupont" <corentin.dupont at gmail.com>
> wrote:
>
> Hello,
> IO is an instance of MonadError IOException...
> However I also need to make it an instance of MonadError String...
> Is it possible?
> I'm trying to instanciate this class:
>
> class (Typeable n, Monad n, Applicative n, MonadError String n) => EvMgt n
> where ...
>
> instance EvMgt IO where...
>
> Any idea?
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160718/065e41b4/attachment.html>


More information about the Haskell-Cafe mailing list