Safe Haskell | None |
---|---|
Language | Haskell2010 |
Types and functions for handling \u0000 values in JSON.
Synopsis
- data HexDigit4 d = HexDigit4 d d d d
- class HasHexDigit4 c d | c -> d where
- parseHexDigit4 :: (CharParsing f, HeXaDeCiMaL digit) => f (HexDigit4 digit)
- hexDigit4ToChar :: HexDigit4 HeXDigit -> Char
- charToHexDigit4 :: Char -> Maybe (HexDigit4 HeXDigit)
Types
JSON Characters may be single escaped UTF16 "uab34".
HexDigit4 d d d d |
Instances
Functor HexDigit4 Source # | |
Foldable HexDigit4 Source # | |
Defined in Waargonaut.Types.JChar.HexDigit4 fold :: Monoid m => HexDigit4 m -> m # foldMap :: Monoid m => (a -> m) -> HexDigit4 a -> m # foldr :: (a -> b -> b) -> b -> HexDigit4 a -> b # foldr' :: (a -> b -> b) -> b -> HexDigit4 a -> b # foldl :: (b -> a -> b) -> b -> HexDigit4 a -> b # foldl' :: (b -> a -> b) -> b -> HexDigit4 a -> b # foldr1 :: (a -> a -> a) -> HexDigit4 a -> a # foldl1 :: (a -> a -> a) -> HexDigit4 a -> a # toList :: HexDigit4 a -> [a] # length :: HexDigit4 a -> Int # elem :: Eq a => a -> HexDigit4 a -> Bool # maximum :: Ord a => HexDigit4 a -> a # minimum :: Ord a => HexDigit4 a -> a # | |
Traversable HexDigit4 Source # | |
Defined in Waargonaut.Types.JChar.HexDigit4 | |
Eq d => Eq (HexDigit4 d) Source # | |
Ord d => Ord (HexDigit4 d) Source # | |
Defined in Waargonaut.Types.JChar.HexDigit4 | |
Show d => Show (HexDigit4 d) Source # | |
HasHexDigit4 (HexDigit4 d) d Source # | |
class HasHexDigit4 c d | c -> d where Source #
Typeclass for things that contain a HexDigit4
.
Parse / Build
parseHexDigit4 :: (CharParsing f, HeXaDeCiMaL digit) => f (HexDigit4 digit) Source #
Parse a single HexDigit4
.
>>>
testparse parseHexDigit4 "1234" :: Either DecodeError (HexDigit4 HeXDigit)
Right (HexDigit4 HeXDigit1 HeXDigit2 HeXDigit3 HeXDigit4)
>>>
testparse parseHexDigit4 "12aF" :: Either DecodeError (HexDigit4 HeXDigit)
Right (HexDigit4 HeXDigit1 HeXDigit2 HeXDigita HeXDigitF)
>>>
testparse parseHexDigit4 "aBcD" :: Either DecodeError (HexDigit4 HeXDigit)
Right (HexDigit4 HeXDigita HeXDigitB HeXDigitc HeXDigitD)
>>>
testparsetheneof parseHexDigit4 "12aF" :: Either DecodeError (HexDigit4 HeXDigit)
Right (HexDigit4 HeXDigit1 HeXDigit2 HeXDigita HeXDigitF)
>>>
testparsethennoteof parseHexDigit4 "12aFx" :: Either DecodeError (HexDigit4 HeXDigit)
Right (HexDigit4 HeXDigit1 HeXDigit2 HeXDigita HeXDigitF)
Conversion
charToHexDigit4 :: Char -> Maybe (HexDigit4 HeXDigit) Source #
Try to convert a Haskell Char
to a JSON acceptable character. NOTE: This
cannot preserve the upper or lower casing of any original Json
data structure
inputs that may have been used to create this Char
. Also the JSON RFC
specifies a "limited" range of U+0000
to U+FFFF
as permissible as a six
character sequence: u0000
.