Added a new helper function, eitherToMaybe in Utils
This commit is contained in:
parent
1a1e78a9c4
commit
c4702a7f6e
|
@ -312,5 +312,9 @@ mapMapWithKeyM f m = liftM Map.fromAscList $ mapM f' $ Map.toAscList m
|
||||||
f' (x,y) = do y' <- f x y
|
f' (x,y) = do y' <- f x y
|
||||||
return (x, y')
|
return (x, y')
|
||||||
|
|
||||||
|
-- | Transforms an Either into a Maybe. If it's a Left value, it is transformed
|
||||||
|
-- into Nothing. If it is a Right value, it is transformed into Just.
|
||||||
|
eitherToMaybe :: Either a b -> Maybe b
|
||||||
|
eitherToMaybe = either (const Nothing) Just
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user