Hello,
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