aboutsummaryrefslogtreecommitdiff
path: root/src/executable/haskell/Utils/Text.hs
blob: 1297bbd0b946f2e3315af18f0a77479e25241ead (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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