Safe Haskell | None |
---|---|
Language | Haskell2010 |
Conversions between several common identifier casing conventions:
PascalCase
- no spacing between words, first letter in word is uppercase, all others are lowercase.camelCase
- likePascalCase
, but the very first letter is lowercase.kebab-case
- everything lowercase, dash delimits words.snake_Case
- underscores delimit words, case is unrestricted.quiet_snake_case
- underscores delimit words, everything lowercase.SCREAMING_SNAKE_CASE
- underscores delimit words, everything uppercase.
Synopsis
- newtype Identifier a = Identifier {
- unIdentifier :: [a]
- fromHumps :: String -> Identifier String
- fromKebab :: String -> Identifier String
- fromSnake :: String -> Identifier String
- fromWords :: String -> Identifier String
- fromAny :: String -> Identifier String
- toCamel :: Identifier String -> String
- toPascal :: Identifier String -> String
- toSnake :: Identifier String -> String
- toQuietSnake :: Identifier String -> String
- toScreamingSnake :: Identifier String -> String
- toKebab :: Identifier String -> String
- toWords :: Identifier String -> String
- pascal :: String -> String
- camel :: String -> String
- snake :: String -> String
- quietSnake :: String -> String
- screamingSnake :: String -> String
- kebab :: String -> String
- wordify :: String -> String
- dropPrefix :: Identifier String -> Identifier String
Types
newtype Identifier a Source #
An opaque type that represents a parsed identifier.
Identifier | |
|
Instances
Parsing
fromHumps :: String -> Identifier String Source #
Convert from "humped" casing (camelCase
or PascalCase
)
Generating
toQuietSnake :: Identifier String -> String Source #
To quiet_snake_case
toScreamingSnake :: Identifier String -> String Source #
To SCREAMING_SNAKE_CASE
Shorthand functions
Miscellaneous
dropPrefix :: Identifier String -> Identifier String Source #
Drop the first word from a parsed identifier. Typical usage is between
parsing and writing, e.g.: toKebab . dropPrefix . fromAny $ "strHelloWorld" == "hello-world"