Rename function

This commit is contained in:
Justin Leitgeb 2014-03-01 06:05:39 -05:00
parent 49ae4e76fa
commit 35870aa5d4
3 changed files with 10 additions and 10 deletions

View File

@ -1,8 +1,8 @@
module Text.Inflections
( dasherize
, decamelize
, decamelizeCustom
, underscore
, underscoreCustom
, defaultMap
@ -23,8 +23,8 @@ import Text.Inflections.Parameterize ( Transliterations
, parameterize
, parameterizeCustom )
import Text.Inflections.Decamelize ( decamelize
, decamelizeCustom )
import Text.Inflections.Underscore ( underscore
, underscoreCustom )
-- |Replaces underscores with dashes in the string.
dasherize :: String -> String

View File

@ -1,15 +1,15 @@
module Text.Inflections.Decamelize (decamelize, decamelizeCustom) where
module Text.Inflections.Underscore (underscore, underscoreCustom) where
import Text.Inflections.Parse.CamelCase (Word(..), parser)
import Text.Parsec (ParseError, parse)
import Data.Char (toLower)
import Data.List (intercalate)
decamelize :: String -> Either ParseError String
decamelize s = decamelizeCustom [] s
underscore :: String -> Either ParseError String
underscore s = underscoreCustom [] s
decamelizeCustom :: [String] -> String -> Either ParseError String
decamelizeCustom acronyms s =
underscoreCustom :: [String] -> String -> Either ParseError String
underscoreCustom acronyms s =
case parse (parser acronyms) "(unknown)" s of
Left errs -> Left errs
Right res -> Right $ intercalate "_" $ map toDowncasedString res

View File

@ -24,7 +24,7 @@ library
, Text.Inflections.Parse.Parameterizable
other-modules: Text.Inflections.Data
, Text.Inflections.Parameterize
, Text.Inflections.Decamelize
, Text.Inflections.Underscore
ghc-options: -Wall
build-depends: base >=4.5 && <4.7, parsec, containers
default-language: Haskell2010