@@ -111,6 +111,7 @@ module Text.Inflections
111111 , toUnderscore
112112 , toDashed
113113 , toCamelCased
114+ , toHumanized
114115 , betterThrow )
115116where
116117
@@ -153,20 +154,39 @@ toDashed :: Text -> Either (ParseError Char Dec) Text
153154toDashed = fmap dasherize . parseCamelCase []
154155
155156-- | Transforms underscored_text to CamelCasedText. If first argument is
156−-- 'True' then FirstCharacter in result string will be in upper case. If
157−-- 'False' then firstCharacter will be in lower case.
157+-- 'True' then the first character in the result string will be in upper case. If
158+-- 'False' then the first character will be in lower case.
158159--
159−-- > toCamelCased t = fmap (camelizeCustom t) . parseSnakeCase []
160+-- > toCamelCased c = fmap (camelizeCustom c) . parseSnakeCase []
160161--
161162-- >>> toCamelCased True "foo_bar_bazz"
162163-- "FooBarBazz"
163164-- >>> toCamelCased False "foo_bar_bazz"
164165-- "fooBarBazz"
165166toCamelCased
166− :: Bool -- ^ Capitalize the first character
167− -> Text -- ^ Input
168− -> Either (ParseError Char Dec) Text -- ^ Ouput
169−toCamelCased t = fmap (camelizeCustom t) . parseSnakeCase []
167+ :: Bool -- ^ Capitalize the first character
168+ -> Text -- ^ Input
169+ -> Either (ParseError Char Dec) Text -- ^ Output
170+toCamelCased c = fmap (camelizeCustom c) . parseSnakeCase []
171+
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
175+-- in lower case.
176+--
177+-- > toHumanized c = fmap (humanizeCustom c) . parseSnakeCase []
178+--
179+-- >>> toHumanized True "foo_bar_bazz"
180+-- "Foo bar bazz"
181+-- >>> toHumanized False "foo_bar_bazz"
182+-- "foo bar bazz"
183+--
184+-- /since 0.3.0.0/
185+toHumanized
186+ :: Bool -- ^ Capitalize the first character
187+ -> Text -- ^ Input
188+ -> Either (ParseError Char Dec) Text -- ^ Output
189+toHumanized c = fmap (humanizeCustom c) . parseSnakeCase []
170190
171191-- | Lift something of type @'Either' ('ParseError' 'Char' 'Dec') a@ to
172192-- an instance of 'MonadThrow'. Useful when you want to shortcut on parsing