mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-06 01:32:50 -06:00
added Functor instance for Err datatype
This commit is contained in:
@@ -26,6 +26,10 @@ instance Monad Err where
|
|||||||
Ok a >>= f = f a
|
Ok a >>= f = f a
|
||||||
Bad s >>= f = Bad s
|
Bad s >>= f = Bad s
|
||||||
|
|
||||||
|
instance Functor Err where -- added 2/10/2003 by PEB
|
||||||
|
fmap f (Ok a) = Ok (f a)
|
||||||
|
fmap f (Bad s) = Bad s
|
||||||
|
|
||||||
-- analogue of maybe
|
-- analogue of maybe
|
||||||
err :: (String -> b) -> (a -> b) -> Err a -> b
|
err :: (String -> b) -> (a -> b) -> Err a -> b
|
||||||
err d f e = case e of
|
err d f e = case e of
|
||||||
|
|||||||
Reference in New Issue
Block a user