diff options
Diffstat (limited to 'fig-utils/src')
| -rw-r--r-- | fig-utils/src/Fig/Prelude.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fig-utils/src/Fig/Prelude.hs b/fig-utils/src/Fig/Prelude.hs index ef2d247..fbbd31c 100644 --- a/fig-utils/src/Fig/Prelude.hs +++ b/fig-utils/src/Fig/Prelude.hs @@ -45,6 +45,7 @@ module Fig.Prelude , tshow , headMay, atMay , throwLeft + , eitherToMaybe , log , (>>>) @@ -114,6 +115,10 @@ throwLeft :: (Exception e, MonadThrow m) => (b -> e) -> Either b a -> m a throwLeft f (Left x) = throwM $ f x throwLeft _ (Right x) = pure x +eitherToMaybe :: Either l r -> Maybe r +eitherToMaybe (Left _) = Nothing +eitherToMaybe (Right x) = Just x + (>>>) :: (a -> b) -> (b -> c) -> a -> c (>>>) = flip (.) |
