Safe Haskell | None |
---|---|
Language | Haskell2010 |
Parsers and builders for whitespace characters in our JSON.
Synopsis
- data Whitespace
- newtype WS = WS (Vector Whitespace)
- _WhitespaceChar :: Prism' Char Whitespace
- escapedWhitespaceChar :: Whitespace -> Char
- unescapedWhitespaceChar :: Whitespace -> Char
- oneWhitespace :: CharParsing f => f Whitespace
- parseWhitespace :: CharParsing f => f WS
- parseSomeWhitespace :: CharParsing f => f (NonEmpty Whitespace)
Documentation
data Whitespace Source #
Represent the different types of whitespace.
Instances
Eq Whitespace Source # | |
Defined in Waargonaut.Types.Whitespace (==) :: Whitespace -> Whitespace -> Bool # (/=) :: Whitespace -> Whitespace -> Bool # | |
Ord Whitespace Source # | |
Defined in Waargonaut.Types.Whitespace compare :: Whitespace -> Whitespace -> Ordering # (<) :: Whitespace -> Whitespace -> Bool # (<=) :: Whitespace -> Whitespace -> Bool # (>) :: Whitespace -> Whitespace -> Bool # (>=) :: Whitespace -> Whitespace -> Bool # max :: Whitespace -> Whitespace -> Whitespace # min :: Whitespace -> Whitespace -> Whitespace # | |
Show Whitespace Source # | |
Defined in Waargonaut.Types.Whitespace showsPrec :: Int -> Whitespace -> ShowS # show :: Whitespace -> String # showList :: [Whitespace] -> ShowS # | |
Cons WS WS Whitespace Whitespace Source # | |
Defined in Waargonaut.Types.Whitespace _Cons :: Prism WS WS (Whitespace, WS) (Whitespace, WS) |
This is a wrapper for a sequence of consecutive whitespace.
WS (Vector Whitespace) |
Instances
_WhitespaceChar :: Prism' Char Whitespace Source #
Handy Prism'
between a Char
its possible Whitespace
representation.
escapedWhitespaceChar :: Whitespace -> Char Source #
Change a Whitespace
into its escaped Char
form.
unescapedWhitespaceChar :: Whitespace -> Char Source #
Change a Whitespace
into a single unescaped Char
. Useful if you're
already handling escaping with some other mechanism.
oneWhitespace :: CharParsing f => f Whitespace Source #
Parse a single Whitespace
character.
parseWhitespace :: CharParsing f => f WS Source #
>>>
testparse parseWhitespace " "
Right (WS [Space])
>>>
testparse parseWhitespace "\n "
Right (WS [NewLine,Space,Space,Space,Space])
>>>
testparse parseWhitespace " \t"
Right (WS [Space,HorizontalTab])
>>>
testparse parseWhitespace "\f\f"
Right (WS [LineFeed,LineFeed])
>>>
testparse parseWhitespace "\r\r\r"
Right (WS [CarriageReturn,CarriageReturn,CarriageReturn])
>>>
testparse parseWhitespace "\n\r\r\n"
Right (WS [NewLine,CarriageReturn,CarriageReturn,NewLine])
>>>
testparse parseWhitespace ""
Right (WS [])
>>>
testparse parseWhitespace "\n ]"
Right (WS [NewLine,Space,Space,Space])
parseSomeWhitespace :: CharParsing f => f (NonEmpty Whitespace) Source #
Parse a NonEmpty
sequence of consecutive whitespace.