| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
ASCII.QuasiQuoters
Synopsis
- char :: QuasiQuoter
- string :: QuasiQuoter
Documentation
char :: QuasiQuoter Source #
Produces an expression or a pattern corresponding to an ASCII character.
The result will have an IsChar constraint; since this is polymorphic, use with a type signature to specify the particular you want is recommended.
The quasi-quoted string must consist of a single character that is within the ASCII character set.
>>>:set -XQuasiQuotes
>>>[char|e|] :: ASCII.CharSmallLetterE
>>>[char|e|] :: Word8101
Use in a pattern context requires enabling the ViewPatterns language extension.
>>>:set -XViewPatterns
>>>case Tilde of [char|@|] -> 1; [char|~|] -> 2; _ -> 32
string :: QuasiQuoter Source #
Produces an expression or a pattern corresponding to an ASCII string.
The result will have an IsString constraint; since this is polymorphic, use with a type signature to specify the particular you want is recommended.
The quasi-quoted string must consist only of characters are within the ASCII character set.
>>>:set -XQuasiQuotes
>>>[string|Hello!|] :: [ASCII.Char][CapitalLetterH,SmallLetterE,SmallLetterL,SmallLetterL,SmallLetterO,ExclamationMark]
>>>[string|Hello!|] :: Data.String.String"Hello!"
>>>[string|Hello!|] :: Data.Text.Text"Hello!"
>>>Data.ByteString.Builder.toLazyByteString [string|Hello!|]"Hello!"
Use in a pattern context requires enabling the ViewPatterns language extension.
>>>:set -XViewPatterns
>>>case [CapitalLetterH, SmallLetterI] of [string|Bye|] -> 1; [string|Hi|] -> 2; _ -> 32