1
0
forked from GitHub/gf-core

added Functor instance for Err datatype

This commit is contained in:
peb
2003-10-06 08:37:59 +00:00
parent 0ac49ec12f
commit 7aa7a3cf19

View File

@@ -26,6 +26,10 @@ instance Monad Err where
Ok a >>= f = f a
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
err :: (String -> b) -> (a -> b) -> Err a -> b
err d f e = case e of