module Text.Inflections.Humanize (humanize) where
import Text.Inflections.Parse.Types (Word(..))
import Data.Char (toUpper)
import Prelude (String, Bool(..), (.), map, zip, ($), unwords, repeat)
humanize
:: [Word]
-> String
humanize = unwords . map caseForWord . isFirstList
isFirstList :: [a] -> [(a, Bool)]
isFirstList xs = zip xs $ True : repeat False
caseForWord :: (Word, Bool) -> String
caseForWord (Word (c:cs), True) = toUpper c : cs
caseForWord (Word s, False) = s
caseForWord (Word [], _) = []
caseForWord (Acronym s, _) = s