Hello,

ErrorT instance of MonadPlus define that in case of fail both arguments of
mplus a value of Error will be the Error of second computation:

    m `mplus` n = ErrorT $ do        a <- runErrorT m        case a of
           Left  _ -> runErrorT n            Right r -> return (Right
r)

Could it be changed in this way:

    m `mplus` n = ErrorT $ do        a <- runErrorT m        case a of
           Left  e -> do

                  b <- runErrorT n

                  case b of

                      Left e' -> return $ Left (e `eplus` e')

                      r -> return r

            r -> return r

where `eplus` could be placed in class Error a:

eplus :: a -> a -> a

eplus x y = y -- default implementation


In this case we could combine Errors more flexible.


Best regards,

Dmitry
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to