summaryrefslogtreecommitdiff
path: root/fig-utils/src/Fig/Prelude.hs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2026-03-07 23:41:50 -0500
committerLLLL Colonq <llll@colonq>2026-03-07 23:41:50 -0500
commitcb85036ca25cd9e13e4e959e105b88bb73dbf9e5 (patch)
tree93bbf019944db71482fd2f6bcd5ffe94442f9bdb /fig-utils/src/Fig/Prelude.hs
parent8cbf224b0edc8646690ebbc877d6f72507447d7a (diff)
Refactor, use app tokens
Diffstat (limited to 'fig-utils/src/Fig/Prelude.hs')
-rw-r--r--fig-utils/src/Fig/Prelude.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/fig-utils/src/Fig/Prelude.hs b/fig-utils/src/Fig/Prelude.hs
index fbbd31c..63ae360 100644
--- a/fig-utils/src/Fig/Prelude.hs
+++ b/fig-utils/src/Fig/Prelude.hs
@@ -44,6 +44,7 @@ module Fig.Prelude
, tshow
, headMay, atMay
+ , hush
, throwLeft
, eitherToMaybe
, log
@@ -111,6 +112,10 @@ atMay [] _ = Nothing
atMay (x:_) 0 = Just x
atMay (_:xs) n = atMay xs $ n - 1
+hush :: Either a b -> Maybe b
+hush (Left _) = Nothing
+hush (Right x) = Just x
+
throwLeft :: (Exception e, MonadThrow m) => (b -> e) -> Either b a -> m a
throwLeft f (Left x) = throwM $ f x
throwLeft _ (Right x) = pure x