[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: [Haskell-cafe] Re: what is inverse of mzero and return?
From:       Jorge Adriano Aires <jadrian () mat ! uc ! pt>
Date:       2005-01-25 17:01:07
Message-ID: 200501251701.08355.jadrian () mat ! uc ! pt
[Download RAW message or body]


> Jules Bean wrote:
> > It's in Control.Monad.Error. Not documented though.
> >
> > Jules
>
> Ahh, so it is:
>
> instance MonadPlus IO where
>         mzero       = ioError (userError "mzero")
>         m `mplus` n = m `catch` \_ -> n
>
> So, the author of this obviously subscribed to the view that
> side-effects are not counted when considering function identity...
(elements of type (IO a) are not functions)

I said it in a previous post, I think there is quite some confusion between 
mplus and what I called skipError = m `catch` \_ -> n. There it is again, 
they were defined to be the same. Doesn't surprise me. Maybe the author just 
didn't take into account the MonadPlus laws (whatever they are).

Also the MonadPlus instance of Maybe doesn't take into account,
(mplus a b) >>= c = mplus (a >>= c) (b >>= c)
So what does that mean?  IMO there are no paradoxes here, just lack of 
specifications. And clearing that up should begin with:


      What are the MonadPlus laws?


J.A.




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic