@@ -96,6 +96,7 @@ module Text.Inflections
96 , camelizeCustom
96 , camelizeCustom
97 , dasherize
97 , dasherize
98 , humanize
98 , humanize
99 , underscore
100 , underscore
100 , titleize
101 , titleize
101 , Transliterations
102 , Transliterations
@@ -110,6 +111,7 @@ module Text.Inflections
110 , toUnderscore
111 , toUnderscore
111 , toDashed
112 , toDashed
112 , toCamelCased
113 , toCamelCased
113 , betterThrow )
115 , betterThrow )
@@ -118,7 +120,7 @@ import Data.Text (Text)
118import Text.Inflections.Camelize (camelize, camelizeCustom)
120import Text.Inflections.Camelize (camelize, camelizeCustom)
119import Text.Inflections.Dasherize (dasherize)
121import Text.Inflections.Dasherize (dasherize)
120import Text.Inflections.Data (Transliterations, defaultTransliterations)
122import Text.Inflections.Data (Transliterations, defaultTransliterations)
121−import Text.Inflections.Humanize (humanize)
123+import Text.Inflections.Humanize (humanize, humanizeCustom)
122import Text.Inflections.Ordinal (ordinal, ordinalize)
124import Text.Inflections.Ordinal (ordinal, ordinalize)
123import Text.Inflections.Parameterize (parameterize, parameterizeCustom)
125import Text.Inflections.Parameterize (parameterize, parameterizeCustom)
124import Text.Inflections.Parse.CamelCase (parseCamelCase)
126import Text.Inflections.Parse.CamelCase (parseCamelCase)
@@ -152,20 +154,39 @@ toDashed :: Text -> Either (ParseError Char Dec) Text
152toDashed = fmap dasherize . parseCamelCase []
154toDashed = fmap dasherize . parseCamelCase []
154-- | Transforms underscored_text to CamelCasedText. If first argument is
156-- | Transforms underscored_text to CamelCasedText. If first argument is
155−-- 'True' then FirstCharacter in result string will be in upper case. If
157+-- 'True' then the first character in the result string will be in upper case. If
156−-- 'False' then firstCharacter will be in lower case.
158+-- 'False' then the first character will be in lower case.
158−-- > toCamelCased t = fmap (camelizeCustom t) . parseSnakeCase []
160+-- > toCamelCased c = fmap (camelizeCustom c) . parseSnakeCase []
160-- >>> toCamelCased True "foo_bar_bazz"
162-- >>> toCamelCased True "foo_bar_bazz"
161-- "FooBarBazz"
163-- "FooBarBazz"
162-- >>> toCamelCased False "foo_bar_bazz"
164-- >>> toCamelCased False "foo_bar_bazz"
163-- "fooBarBazz"
165-- "fooBarBazz"
164toCamelCased
166toCamelCased
165− :: Bool -- ^ Capitalize the first character
167+ :: Bool -- ^ Capitalize the first character
166− -> Text -- ^ Input
168+ -> Text -- ^ Input
167− -> Either (ParseError Char Dec) Text -- ^ Ouput
169+ -> Either (ParseError Char Dec) Text -- ^ Output
168−toCamelCased t = fmap (camelizeCustom t) . parseSnakeCase []
170+toCamelCased c = fmap (camelizeCustom c) . parseSnakeCase []
172+-- | Transforms underscored_text to space-separated human-readable text.
173+-- If first argument is 'True' then the first character in the result
174+-- string will be in upper case. If 'False' then the first character will be
177+-- > toHumanized c = fmap (humanizeCustom c) . parseSnakeCase []
179+-- >>> toHumanized True "foo_bar_bazz"
181+-- >>> toHumanized False "foo_bar_bazz"
186+ :: Bool -- ^ Capitalize the first character
188+ -> Either (ParseError Char Dec) Text -- ^ Output
189+toHumanized c = fmap (humanizeCustom c) . parseSnakeCase []
170-- | Lift something of type @'Either' ('ParseError' 'Char' 'Dec') a@ to
191-- | Lift something of type @'Either' ('ParseError' 'Char' 'Dec') a@ to
171-- an instance of 'MonadThrow'. Useful when you want to shortcut on parsing
192-- an instance of 'MonadThrow'. Useful when you want to shortcut on parsing