character-cases-0.1.0.0: Exposes subspecies types of Char. And naming cases. e.g. meaning of [a-z], [A-Z], [0-9], PascalCase, camelCase, and sneak_case.

Safe HaskellNone
LanguageHaskell2010

Data.String.Cases

Description

Exposes naming cases.

Synopsis

Documentation

>>> :set -XQuasiQuotes

data Pascal Source #

Non empty PascalCase names "[A-Z][a-zA-Z0-9]*"

Constructors

Pascal UpperChar [AlphaNumChar] 
Instances
Eq Pascal Source # 
Instance details

Defined in Data.String.Cases

Methods

(==) :: Pascal -> Pascal -> Bool #

(/=) :: Pascal -> Pascal -> Bool #

Show Pascal Source # 
Instance details

Defined in Data.String.Cases

Pretty Pascal Source # 
Instance details

Defined in Data.String.Cases

Methods

pretty :: Pascal -> Doc ann #

prettyList :: [Pascal] -> Doc ann #

pascalQ :: QuasiQuoter Source #

Simular to nonEmptyQ, but naming outsides of Pascal will be rejected.

>>> [pascalQ|Pascal|]
Pascal P [AlphaNumAlpha (AlphaLower A_),AlphaNumAlpha (AlphaLower S_),AlphaNumAlpha (AlphaLower C_),AlphaNumAlpha (AlphaLower A_),AlphaNumAlpha (AlphaLower L_)]

data NonEmpty Source #

Non empty names ".+"

Constructors

NonEmpty Char String 
Instances
Eq NonEmpty Source # 
Instance details

Defined in Data.String.Cases

Show NonEmpty Source # 
Instance details

Defined in Data.String.Cases

Pretty NonEmpty Source # 
Instance details

Defined in Data.String.Cases

Methods

pretty :: NonEmpty -> Doc ann #

prettyList :: [NonEmpty] -> Doc ann #

nonEmptyQ :: QuasiQuoter Source #

Makes a non empty string from String on the compile time. Also throws compile error if the empty string is passed.

>>> [nonEmptyQ|x|]
NonEmpty 'x' ""
>>> [nonEmptyQ|foo|]
NonEmpty 'f' "oo"
>>> [nonEmptyQ|Bar|]
NonEmpty 'B' "ar"

data Camel Source #

Non empty camelCase names "[a-zA-Z][a-zA-Z0-9]*"

Constructors

Camel AlphaChar [AlphaNumChar] 
Instances
Eq Camel Source # 
Instance details

Defined in Data.String.Cases

Methods

(==) :: Camel -> Camel -> Bool #

(/=) :: Camel -> Camel -> Bool #

Show Camel Source # 
Instance details

Defined in Data.String.Cases

Methods

showsPrec :: Int -> Camel -> ShowS #

show :: Camel -> String #

showList :: [Camel] -> ShowS #

Pretty Camel Source # 
Instance details

Defined in Data.String.Cases

Methods

pretty :: Camel -> Doc ann #

prettyList :: [Camel] -> Doc ann #

camelQ :: QuasiQuoter Source #

Simular to nonEmptyQ, but naming outsides of Camel will be rejected.

>>> [camelQ|camel|]
"camel"
>>> [camelQ|Pascal|]
"Pascal"

data Sneak Source #

Non empty sneak_case names "[a-zA-Z_][a-zA-Z0-9_]*"

Constructors

Sneak SneakHeadChar [SneakChar] 
Instances
Eq Sneak Source # 
Instance details

Defined in Data.String.Cases

Methods

(==) :: Sneak -> Sneak -> Bool #

(/=) :: Sneak -> Sneak -> Bool #

Show Sneak Source # 
Instance details

Defined in Data.String.Cases

Methods

showsPrec :: Int -> Sneak -> ShowS #

show :: Sneak -> String #

showList :: [Sneak] -> ShowS #

Pretty Sneak Source # 
Instance details

Defined in Data.String.Cases

Methods

pretty :: Sneak -> Doc ann #

prettyList :: [Sneak] -> Doc ann #

sneakQ :: QuasiQuoter Source #

Simular to nonEmptyQ, but naming outsides of Sneak will be rejected.

>>> [sneakQ|foo_bar|]
Sneak (SneakHeadAlpha (AlphaLower F_)) [SneakAlphaNum (AlphaNumAlpha (AlphaLower O_)),SneakAlphaNum (AlphaNumAlpha (AlphaLower O_)),SneakUnderscore,SneakAlphaNum (AlphaNumAlpha (AlphaLower B_)),SneakAlphaNum (AlphaNumAlpha (AlphaLower A_)),SneakAlphaNum (AlphaNumAlpha (AlphaLower R_))]
>>> [sneakQ|__constructor|]
Sneak SneakHeadUnderscore [SneakUnderscore,SneakAlphaNum (AlphaNumAlpha (AlphaLower C_)),SneakAlphaNum (AlphaNumAlpha (AlphaLower O_)),SneakAlphaNum (AlphaNumAlpha (AlphaLower N_)),SneakAlphaNum (AlphaNumAlpha (AlphaLower S_)),SneakAlphaNum (AlphaNumAlpha (AlphaLower T_)),SneakAlphaNum (AlphaNumAlpha (AlphaLower R_)),SneakAlphaNum (AlphaNumAlpha (AlphaLower U_)),SneakAlphaNum (AlphaNumAlpha (AlphaLower C_)),SneakAlphaNum (AlphaNumAlpha (AlphaLower T_)),SneakAlphaNum (AlphaNumAlpha (AlphaLower O_)),SneakAlphaNum (AlphaNumAlpha (AlphaLower R_))]
>>> [sneakQ|FOO_MEE_9|]
Sneak (SneakHeadAlpha (AlphaUpper F)) [SneakAlphaNum (AlphaNumAlpha (AlphaUpper O)),SneakAlphaNum (AlphaNumAlpha (AlphaUpper O)),SneakUnderscore,SneakAlphaNum (AlphaNumAlpha (AlphaUpper M)),SneakAlphaNum (AlphaNumAlpha (AlphaUpper E)),SneakAlphaNum (AlphaNumAlpha (AlphaUpper E)),SneakUnderscore,SneakAlphaNum (AlphaNumDigit D9)]

data LowerString Source #

Non empty "veryflatten" names [a-z]+

Instances
Eq LowerString Source # 
Instance details

Defined in Data.String.Cases

Show LowerString Source # 
Instance details

Defined in Data.String.Cases

Pretty LowerString Source # 
Instance details

Defined in Data.String.Cases

Methods

pretty :: LowerString -> Doc ann #

prettyList :: [LowerString] -> Doc ann #

lowerStringQ :: QuasiQuoter Source #

Simular to nonEmptyQ, but naming outsides of LowerString will be rejected.

>>> [lowerStringQ|imavimmer|]
LowerString I_ [M_,A_,V_,I_,M_,M_,E_,R_]