On Tuesday 17 May 2011 01:40:41, Gracjan Polak wrote:
> Daniel Fischer googlemail.com> writes:
> > On Monday 16 May 2011 23:41:44, Gracjan Polak wrote:
> > > Thanks Daniel, Yves and Edward for explanation. Two things come to
> > > my mind now.
> > >
> > > 1. It should be unified.
> >
> > The (Ei
On Mon, May 16, 2011 at 8:40 PM, Gracjan Polak wrote:
> result <- runErrorT $ do
> lift $ print "was here"
> fail "msg"
>
> (result = Left "msg")
>
> after a while the print statement may be removed:
>
> result <- runErrorT $ do
> fail "msg"
>
> (result = Left "msg")
That seems pr
Daniel Fischer googlemail.com> writes:
>
> On Monday 16 May 2011 23:41:44, Gracjan Polak wrote:
> > Thanks Daniel, Yves and Edward for explanation. Two things come to my
> > mind now.
> >
> > 1. It should be unified.
>
> The (Either e) Monad instance was recently changed after people have long
On Monday 16 May 2011 23:41:44, Gracjan Polak wrote:
> Thanks Daniel, Yves and Edward for explanation. Two things come to my
> mind now.
>
> 1. It should be unified.
The (Either e) Monad instance was recently changed after people have long
complained that there shouldn't be an (Error e) constrai
On Mon, May 16, 2011 at 4:41 PM, Gracjan Polak wrote:
>
> Thanks Daniel, Yves and Edward for explanation. Two things come to my mind
> now.
>
> 1. It should be unified. Why? Because conceptually:
>
> runIdentity (runErrorT (fail "msg")) :: Either String Int
> Left "msg"
>
> and
>
> fail "msg" ::
Thanks Daniel, Yves and Edward for explanation. Two things come to my mind now.
1. It should be unified. Why? Because conceptually:
runIdentity (runErrorT (fail "msg")) :: Either String Int
Left "msg"
and
fail "msg" :: Either String Int
*** Exception: msg
Should be the same as Identity monad
On Monday 16 May 2011 23:05:22, Yves Parès wrote:
> Probably because in the instance of Monad Either, fail has not been
> overloaded, and still has its default implementation:
> fail = error
Right. It used to be different in mtl-1.*, when there was an
instance Error e => Monad (Either e) where
I suspect it is because the "fail" method for the 'Either' monad
instance makes use of Haskell's error function, since the instance is
defined generally and there is no way to override it for (Either
String a).
On May 16, 2011, Gracjan Polak wrote:
> Control.Monad.Error Prelude> runErrorT (fail
Probably because in the instance of Monad Either, fail has not been
overloaded, and still has its default implementation:
fail = error
Whereas runErrorT explicitely catches the exception.
2011/5/16 Gracjan Polak
>
> Hi all,
>
> A why question: Why:
>
> Control.Monad.Error Prelude> runErrorT (fa
Hi all,
A why question: Why:
Control.Monad.Error Prelude> runErrorT (fail "msg") :: IO (Either String Int)
Left "msg"
but
Control.Monad.Error Prelude> (fail "msg") :: (Either String Int)
*** Exception: msg
?
--
Gracjan
___
Haskell-Cafe mailing
10 matches
Mail list logo