aboutsummaryrefslogtreecommitdiff
path: root/src/executable/haskell/Utils/Text.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/executable/haskell/Utils/Text.hs')
-rw-r--r--src/executable/haskell/Utils/Text.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/executable/haskell/Utils/Text.hs b/src/executable/haskell/Utils/Text.hs
new file mode 100644
index 0000000..1297bbd
--- /dev/null
+++ b/src/executable/haskell/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