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.
Instances
Eq WS Source # | |
Show WS Source # | |
Semigroup WS Source # | |
Monoid WS Source # | |
Wrapped WS Source # | |
AsEmpty WS Source # | |
Defined in Waargonaut.Types.Whitespace | |
WS ~ t => Rewrapped WS t Source # | |
Defined in Waargonaut.Types.Whitespace | |
AsJType Json WS Json Source # | |
Cons WS WS Whitespace Whitespace Source # | |
Defined in Waargonaut.Types.Whitespace _Cons :: Prism WS WS (Whitespace, WS) (Whitespace, WS) # | |
Applicative f => Divisible (EncoderFns (JObject WS Json) f) Source # | |
Defined in Waargonaut.Encode.Types divide :: (a -> (b, c)) -> EncoderFns (JObject WS Json) f b -> EncoderFns (JObject WS Json) f c -> EncoderFns (JObject WS Json) f a # | |
Applicative f => Decidable (EncoderFns (JObject WS Json) f) Source # | |
Defined in Waargonaut.Encode.Types | |
type Unwrapped WS Source # | |
Defined in Waargonaut.Types.Whitespace |
_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.