mirror of
https://github.com/typeable/inflections-hs.git
synced 2024-09-11 06:05:33 +03:00
Use explicit imports from Prelude
To avoid ambigous references due to Prelude in 7.10 re-exporting 'Word'.
This commit is contained in:
parent
0dce9ad128
commit
2fa7fc2c15
@ -4,6 +4,8 @@ import Text.Inflections.Parse.Types (Word(..))
|
||||
|
||||
import Data.Char (toUpper, toLower)
|
||||
|
||||
import Prelude (String, Bool(..), concatMap, (.), zip, ($), repeat)
|
||||
|
||||
-- |Turns a an input Word List in into CamelCase. Returns the CamelCase String.
|
||||
camelize
|
||||
:: [Word] -- ^ Input Words to separate with underscores
|
||||
|
@ -4,6 +4,8 @@ import Text.Inflections.Parse.Types (Word(..))
|
||||
|
||||
import Data.List (intercalate)
|
||||
|
||||
import Prelude (String, (.), map)
|
||||
|
||||
-- | Replaces underscores in a snake_cased string with dashes (hyphens).
|
||||
dasherize
|
||||
:: [Word] -- ^ Input Words to separate with dashes
|
||||
|
@ -5,6 +5,8 @@ import Text.Inflections.Parse.Types (Word(..))
|
||||
import Data.List (intercalate)
|
||||
import Data.Char (toUpper)
|
||||
|
||||
import Prelude (String, Bool(..), (.), map, zip, ($), unwords, repeat)
|
||||
|
||||
-- |Capitalizes the first word and turns underscores into spaces. Like titleize,
|
||||
-- this is meant for creating pretty output.
|
||||
humanize
|
||||
|
@ -10,5 +10,7 @@ import Text.Inflections.Parse.Types
|
||||
|
||||
import Control.Applicative ((<$>))
|
||||
|
||||
import Prelude (Char, String, (.), map)
|
||||
|
||||
acronym :: P.Stream s m Char => [String] -> P.ParsecT s u m Word
|
||||
acronym as = Acronym <$> P.choice (map (Prim.try . C.string) as)
|
||||
|
@ -8,6 +8,8 @@ import Text.Parsec
|
||||
import Text.Inflections.Parse.Types (Word(..))
|
||||
import Text.Inflections.Parse.Acronym (acronym)
|
||||
|
||||
import Prelude (Char, String, Either, return, ($))
|
||||
|
||||
parseCamelCase :: [String] -> String -> Either ParseError [Word]
|
||||
parseCamelCase acronyms = parse (parser acronyms) "(unknown)"
|
||||
|
||||
|
@ -9,6 +9,8 @@ import Text.Parsec
|
||||
import Text.Inflections.Parse.Types (Word(..))
|
||||
import Text.Inflections.Parse.Acronym (acronym)
|
||||
|
||||
import Prelude (Char, String, Either, return)
|
||||
|
||||
parseSnakeCase :: [String] -> String -> Either ParseError [Word]
|
||||
parseSnakeCase acronyms = parse (parser acronyms) "(unknown)"
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
module Text.Inflections.Parse.Types ( Word(..), mapWord ) where
|
||||
|
||||
import Prelude (String, Show, Eq, ($))
|
||||
|
||||
-- | A 'String' that should be kept whole through applied inflections
|
||||
data Word
|
||||
|
||||
|
@ -5,6 +5,8 @@ import Text.Inflections.Parse.Types (Word(..))
|
||||
import Data.List (intercalate)
|
||||
import Data.Char (toUpper)
|
||||
|
||||
import Prelude (String, unwords, map, ($))
|
||||
|
||||
-- | Capitalizes all the Words in the input 'Data.List'.
|
||||
titleize
|
||||
:: [Word] -- ^ List of Words, first of which will be capitalized
|
||||
|
@ -5,6 +5,8 @@ import Text.Inflections.Parse.Types (Word(..))
|
||||
import Data.Char (toLower)
|
||||
import Data.List (intercalate)
|
||||
|
||||
import Prelude (String, (.), map)
|
||||
|
||||
-- |Turns a CamelCase string into an underscore_separated String.
|
||||
underscore
|
||||
:: [Word] -- ^ Input Words to separate with underscores
|
||||
|
Loading…
Reference in New Issue
Block a user