Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- instance Monad (Either s) where
- return x = Right x
- (Left s) >>= _ = Left s
- (Right x) >>= f = f x
- myDiv :: (Fractional f) => f -> f -> Either [Char] f
- myDiv _ 0 = Left "Division by zero"
- myDiv a b = Right (a/b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement