module Summoner.Text
( packageToModule
, intercalateMap
, headToUpper
, tconcatMap
) where
import qualified Data.Char as C
import qualified Data.Text as T
packageToModule :: Text -> Text
packageToModule = tconcatMap headToUpper . T.splitOn "-"
intercalateMap :: Text -> (a -> Text) -> [a] -> Text
intercalateMap between showT = T.intercalate between . map showT
headToUpper :: Text -> Text
headToUpper t = case T.uncons t of
Nothing -> ""
Just (x, xs) -> T.cons (C.toUpper x) xs
tconcatMap :: (a -> Text) -> [a] -> Text
tconcatMap f = T.concat . map f