| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
ASCII.TemplateHaskell
Characters
charPat :: Char -> Q Pat Source #
let
x = case SmallLetterS of
$(charPat SmallLetterR) -> 1
$(charPat SmallLetterS) -> 2
_ -> 3
in
x == 2
Character lists
charListExp :: [Char] -> Q Exp Source #
$(charListExp [CapitalLetterH, SmallLetterI]) == [CapitalLetterH, SmallLetterI]
charListPat :: [Char] -> Q Pat Source #
let
x = case [CapitalLetterH, SmallLetterI] of
$(charListPat [CapitalLetterH, SmallLetterA]) -> 1
$(charListPat [CapitalLetterH, SmallLetterI]) -> 2
_ -> 3
in
x == 2
Character supersets
isCharExp :: Char -> Q Exp Source #
Expression with a FromChar constraint
$(isCharExp CapitalLetterA) == CapitalLetterA $(isCharExp CapitalLetterA) == (65 :: Word8) $(isCharExp CapitalLetterA) == (asciiUnsafe65 ::ASCIIWord8)
isCharPat :: Char -> Q Pat Source #
Pattern that matches a type with a ToChar constraint
let
x = case (66 :: Word8) of
$(isCharPat CapitalLetterA) -> 1
$(isCharPat CapitalLetterB) -> 2
_ -> 3
in
x == 2
String supersets
isStringExp :: [Char] -> Q Exp Source #
Expression with a FromString constraint
isStringPat :: [Char] -> Q Pat Source #
Pattern that matches a type with a ToString constraint