mirror of
https://github.com/typeable/inflections-hs.git
synced 2024-09-11 06:05:33 +03:00
Rename function
This commit is contained in:
parent
49ae4e76fa
commit
35870aa5d4
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user