
1 Nov
2014
1 Nov
'14
6:38 a.m.
On 31/10/14 23:22, Kim-Ee Yeoh wrote:
On Thu, Oct 30, 2014 at 8:50 PM, Roman Cheplyaka
wrote: liftA2 (<|>) b a
B A Right 42
(In the latter case I don't want A in the output…)
Wrap it into ExceptT (from the latest transformers), as in
runExceptT $ ExceptT a <|> ExceptT b
With the latest transformers, I still get
B A Right 42
i.e. the A hasn't been eliminated.
What am I missing?
I don't know what you're missing, but when I run the following code, it doesn't print A. import Control.Monad.Except import Control.Applicative a = putStrLn "A" >> return (Left "hehe") b = putStrLn "B" >> return (Right 42) main = runExceptT $ ExceptT b <|> ExceptT a Roman