aboutsummaryrefslogtreecommitdiff
path: root/src/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils')
-rw-r--r--src/Utils/Text.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Utils/Text.hs b/src/Utils/Text.hs
new file mode 100644
index 0000000..1297bbd
--- /dev/null
+++ b/src/Utils/Text.hs
@@ -0,0 +1,13 @@
+module Utils.Text
+ ( startsWith
+ ) where
+
+import Data.Text (Text)
+import qualified Data.Text as T
+
+startsWith :: Text -> Text -> Bool
+startsWith mbStart text =
+ case (T.uncons mbStart, T.uncons text) of
+ (Just (x, xs), Just (y, ys)) -> x == y && startsWith xs ys
+ (Nothing, _) -> True
+ _ -> False