Added a useful transformEither function to Utils
This commit is contained in:
parent
68a3b3f4bc
commit
f700392676
5
Utils.hs
5
Utils.hs
|
@ -34,3 +34,8 @@ doMaybe :: Monad m => Maybe (m ()) -> m ()
|
||||||
doMaybe (Just a) = a
|
doMaybe (Just a) = a
|
||||||
doMaybe Nothing = return ()
|
doMaybe Nothing = return ()
|
||||||
|
|
||||||
|
-- | Transforms between two Either types using the appropriate convert function:
|
||||||
|
transformEither :: (a -> c) -> (b -> d) -> Either a b -> Either c d
|
||||||
|
transformEither funcLeft funcRight x = case x of
|
||||||
|
Left l -> Left (funcLeft l)
|
||||||
|
Right r -> Right (funcRight r)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user