aboutsummaryrefslogtreecommitdiff
path: root/src/Utils
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-04-12 22:46:56 +0200
committerJoris Guyonvarch2015-04-12 22:47:27 +0200
commit10a9aa9391ac2995527557d9d808693b57236603 (patch)
treed1aae79b86a7d289b5733519683302c712fe96da /src/Utils
parent293fab1df23821b5f131603c4db56ab71681ce59 (diff)
Ignore lines beginning with # in the configuration file
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