inflections 0.1.0.6 → 0.1.0.7
raw patch · 10 files changed
+16/−17 lines, 10 filesdep ~base
Dependency ranges changed: base
Files
- Text/Inflections/Camelize.hs +1/−1
- Text/Inflections/Dasherize.hs +2/−2
- Text/Inflections/Humanize.hs +1/−1
- Text/Inflections/Parse/Acronym.hs +1/−1
- Text/Inflections/Parse/SnakeCase.hs +2/−2
- Text/Inflections/Parse/Types.hs +1/−1
- Text/Inflections/Titleize.hs +2/−2
- Text/Inflections/Transliterate.hs +2/−3
- Text/Inflections/Underscore.hs +1/−1
- inflections.cabal +3/−3
Text/Inflections/Camelize.hs view
@@ -8,7 +8,7 @@ camelize :: [Word] -- ^ Input Words to separate with underscores -> String -- ^ The camelized String-camelize ws = camelizeCustom True ws+camelize = camelizeCustom True -- |Turns an input Word List into a CamelCase String. camelizeCustom
Text/Inflections/Dasherize.hs view
@@ -4,11 +4,11 @@ import Data.List (intercalate) --- |Replaces underscores in a snake_cased string with dashes (hyphens).+-- | Replaces underscores in a snake_cased string with dashes (hyphens). dasherize :: [Word] -- ^ Input Words to separate with dashes -> String -- ^ The dasherized String-dasherize ws = intercalate "-" $ map toString ws+dasherize = intercalate "-" . map toString toString :: Word -> String toString (Acronym s) = s
Text/Inflections/Humanize.hs view
@@ -10,7 +10,7 @@ humanize :: [Word] -- ^ List of Words, first of which will be capitalized -> String -- ^ The humanized output-humanize s = intercalate " " $ map caseForWord $ isFirstList s+humanize = unwords . map caseForWord . isFirstList -- |Returns list with Bool indicating if an element is first. isFirstList :: [a] -> [(a, Bool)]
Text/Inflections/Parse/Acronym.hs view
@@ -11,4 +11,4 @@ import Control.Applicative ((<$>)) acronym :: P.Stream s m Char => [String] -> P.ParsecT s u m Word-acronym as = Acronym <$> (P.choice $ map (Prim.try . C.string) as)+acronym as = Acronym <$> P.choice (map (Prim.try . C.string) as)
Text/Inflections/Parse/SnakeCase.hs view
@@ -15,9 +15,9 @@ parser :: Stream s m Char => [String] -> ParsecT s u m [Word] parser acronyms = do- ws <- (acronym acronyms <|> word) `sepBy` (char '_')+ ws <- (acronym acronyms <|> word) `sepBy` char '_' eof return ws word :: Stream s m Char => ParsecT s u m Word-word = Word <$> ((many1 lower) <|> (many1 digit))+word = Word <$> (many1 lower <|> many1 digit)
Text/Inflections/Parse/Types.hs view
@@ -1,6 +1,6 @@ module Text.Inflections.Parse.Types ( Word(..) ) where --- |A 'String' that should be kept whole through applied inflections+-- | A 'String' that should be kept whole through applied inflections data Word -- | A word that may be transformed by inflection
Text/Inflections/Titleize.hs view
@@ -5,11 +5,11 @@ import Data.List (intercalate) import Data.Char (toUpper) --- |Capitalizes Capitalizes all the words.+-- | Capitalizes all the Words in the input 'Data.List'. titleize :: [Word] -- ^ List of Words, first of which will be capitalized -> String -- ^ The titleized String-titleize s = intercalate " " $ map upperCaseWord s+titleize s = unwords $ map upperCaseWord s upperCaseWord :: Word -> String upperCaseWord (Word (c:cs)) = toUpper c : cs
Text/Inflections/Transliterate.hs view
@@ -8,6 +8,7 @@ import Text.Inflections.Data (defaultMap) import Data.Char (isAscii)+import Data.Maybe(fromMaybe) import qualified Data.Map as Map @@ -26,6 +27,4 @@ if isAscii c then -- Don't bother looking up Chars in ASCII range [c] else- case Map.lookup c ts of- Nothing -> replacement- Just val -> val+ fromMaybe replacement (Map.lookup c ts)
Text/Inflections/Underscore.hs view
@@ -9,7 +9,7 @@ underscore :: [Word] -- ^ Input Words to separate with underscores -> String -- ^ The underscored String-underscore ws = intercalate "_" $ map toDowncasedString ws+underscore = intercalate "_" . map toDowncasedString toDowncasedString :: Word -> String
inflections.cabal view
@@ -1,5 +1,5 @@ name: inflections-version: 0.1.0.6+version: 0.1.0.7 synopsis: Inflections library for Haskell description: Inflections provides methods for singularization, pluralization,@@ -41,7 +41,7 @@ , Text.Inflections.Parse.CamelCase ghc-options: -Wall- build-depends: base >=4.5 && <4.7, parsec, containers+ build-depends: base >=4.5 && <4.8, parsec, containers default-language: Haskell2010 test-suite test@@ -50,7 +50,7 @@ main-is: Suite.hs build-depends: inflections- , base >=4.5 && <4.7+ , base >=4.5 && <4.8 , test-framework , HUnit , QuickCheck