module Data.Aeson.AutoType.Format(capitalize, uncapitalize) where
import Data.Text(Text)
import qualified Data.Text as Text
capitalize :: Text -> Text
capitalize :: Text -> Text
capitalize word :: Text
word = Text -> Text
Text.toUpper Text
first Text -> Text -> Text
`Text.append` Text
rest
where
(first :: Text
first, rest :: Text
rest) = Int -> Text -> (Text, Text)
Text.splitAt 1 Text
word
uncapitalize :: Text -> Text
uncapitalize :: Text -> Text
uncapitalize word :: Text
word = Text -> Text
Text.toLower Text
first Text -> Text -> Text
`Text.append` Text
rest
where
(first :: Text
first, rest :: Text
rest) = Int -> Text -> (Text, Text)
Text.splitAt 1 Text
word