summaryrefslogtreecommitdiff
path: root/Alpha.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Alpha.hs')
-rw-r--r--Alpha.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/Alpha.hs b/Alpha.hs
index 556f8df..f95d234 100644
--- a/Alpha.hs
+++ b/Alpha.hs
@@ -43,6 +43,9 @@ module Alpha
-- * String
capitalize,
+ -- * Data Validation
+ require,
+
-- * Debugging tools
say,
)
@@ -115,3 +118,7 @@ instance CanSnakeCase Text where
capitalize :: String -> String
capitalize [] = []
capitalize str = (Char.toUpper <| List.head str) : (Char.toLower </ List.tail str)
+
+require :: Text -> Maybe a -> a
+require _ (Just x) = x
+require s Nothing = panic <| s <> " not found"