waargonaut-0.8.0.1: JSON wrangling

Safe HaskellNone
LanguageHaskell2010

Waargonaut.Types.JChar.HexDigit4

Contents

Description

Types and functions for handling \u0000 values in JSON.

Synopsis

Types

data HexDigit4 d Source #

JSON Characters may be single escaped UTF16 "uab34".

Constructors

HexDigit4 d d d d 
Instances
Functor HexDigit4 Source # 
Instance details

Defined in Waargonaut.Types.JChar.HexDigit4

Methods

fmap :: (a -> b) -> HexDigit4 a -> HexDigit4 b #

(<$) :: a -> HexDigit4 b -> HexDigit4 a #

Foldable HexDigit4 Source # 
Instance details

Defined in Waargonaut.Types.JChar.HexDigit4

Methods

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] #

null :: HexDigit4 a -> Bool #

length :: HexDigit4 a -> Int #

elem :: Eq a => a -> HexDigit4 a -> Bool #

maximum :: Ord a => HexDigit4 a -> a #

minimum :: Ord a => HexDigit4 a -> a #

sum :: Num a => HexDigit4 a -> a #

product :: Num a => HexDigit4 a -> a #

Traversable HexDigit4 Source # 
Instance details

Defined in Waargonaut.Types.JChar.HexDigit4

Methods

traverse :: Applicative f => (a -> f b) -> HexDigit4 a -> f (HexDigit4 b) #

sequenceA :: Applicative f => HexDigit4 (f a) -> f (HexDigit4 a) #

mapM :: Monad m => (a -> m b) -> HexDigit4 a -> m (HexDigit4 b) #

sequence :: Monad m => HexDigit4 (m a) -> m (HexDigit4 a) #

Eq d => Eq (HexDigit4 d) Source # 
Instance details

Defined in Waargonaut.Types.JChar.HexDigit4

Methods

(==) :: HexDigit4 d -> HexDigit4 d -> Bool #

(/=) :: HexDigit4 d -> HexDigit4 d -> Bool #

Ord d => Ord (HexDigit4 d) Source # 
Instance details

Defined in Waargonaut.Types.JChar.HexDigit4

Show d => Show (HexDigit4 d) Source # 
Instance details

Defined in Waargonaut.Types.JChar.HexDigit4

HasHexDigit4 (HexDigit4 d) d Source # 
Instance details

Defined in Waargonaut.Types.JChar.HexDigit4

class HasHexDigit4 c d | c -> d where Source #

Typeclass for things that contain a HexDigit4.

Methods

hexDigit4 :: Lens' c (HexDigit4 d) Source #

Instances
HasHexDigit4 (HexDigit4 d) d Source # 
Instance details

Defined in Waargonaut.Types.JChar.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

hexDigit4ToChar :: HexDigit4 HeXDigit -> Char Source #

Convert a given HexDigit4 to a Haskell Char.

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.