on master help sign in
Monad instance for (Either e)
4043a0cstartling
lib/Prelude.idr+6
@@ -86,6 +86,12 @@ instance MonadPlus Maybe where
86 mplus Nothing (Just y) = Just y
86 mplus Nothing (Just y) = Just y
87 mplus Nothing Nothing = Nothing
87 mplus Nothing Nothing = Nothing
88
88
89+instance Monad (Either e) where
90+ return = Right
91+
92+ (Left n) >>= _ = Left n
93+ (Right r) >>= f = f r
94+
89instance Monad List where
95instance Monad List where
90 return x = [x]
96 return x = [x]
91 m >>= f = concatMap f m
97 m >>= f = concatMap f m