diff options
Diffstat (limited to 'Alpha.hs')
-rw-r--r-- | Alpha.hs | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -55,6 +55,7 @@ module Alpha (?+), -- * Text + str, tshow, chomp, lchomp, @@ -200,18 +201,18 @@ don't = do not {-# ANN don't ("HLint: ignore Redundant do" :: String) #-} -- | Class for turning different string types to snakeCase. -class CanSnakeCase str where - snake :: str -> str +class CanSnakeCase s where + snake :: s -> s instance CanSnakeCase Text where snake = Text.toLower .> Text.replace " " "-" capitalize :: String -> String capitalize [] = [] -capitalize str = (Char.toUpper <| List.head str) : (Char.toLower </ List.tail str) +capitalize s = (Char.toUpper <| List.head s) : (Char.toLower </ List.tail s) lowercase :: String -> String -lowercase str = [Char.toLower c | c <- str] +lowercase s = [Char.toLower c | c <- s] {-# WARNING require "'require' remains in code" #-} require :: Text -> Maybe a -> a @@ -231,5 +232,8 @@ wrap lim = Text.words .> wrap_ 0 .> Text.unwords where lw = Text.length w +str :: StringConv a b => a -> b +str = toS + tshow :: Show a => a -> Text tshow = show |