aeson-extra-0.5: Extra goodies for aeson
Copyright(C) 2015-2016 Oleg Grenrus
LicenseBSD3
MaintainerOleg Grenrus <oleg.grenrus@iki.fi>
Safe HaskellNone
LanguageHaskell2010

Data.Aeson.Extra.SingObject

Description

 
Synopsis

Documentation

newtype SingObject (s :: Symbol) a Source #

Singleton value object

λ > decode "{\"value\": 42 }" :: Maybe (SingObject "value" Int)
Just (SingObject 42)
λ > encode (SingObject 42 :: SingObject "value" Int)
"{\"value\":42}"

Available with: base >=4.7

Constructors

SingObject a 

Instances

Instances details
Functor (SingObject s) Source # 
Instance details

Defined in Data.Aeson.Extra.SingObject

Methods

fmap :: (a -> b) -> SingObject s a -> SingObject s b #

(<$) :: a -> SingObject s b -> SingObject s a #

Foldable (SingObject s) Source # 
Instance details

Defined in Data.Aeson.Extra.SingObject

Methods

fold :: Monoid m => SingObject s m -> m #

foldMap :: Monoid m => (a -> m) -> SingObject s a -> m #

foldMap' :: Monoid m => (a -> m) -> SingObject s a -> m #

foldr :: (a -> b -> b) -> b -> SingObject s a -> b #

foldr' :: (a -> b -> b) -> b -> SingObject s a -> b #

foldl :: (b -> a -> b) -> b -> SingObject s a -> b #

foldl' :: (b -> a -> b) -> b -> SingObject s a -> b #

foldr1 :: (a -> a -> a) -> SingObject s a -> a #

foldl1 :: (a -> a -> a) -> SingObject s a -> a #

toList :: SingObject s a -> [a] #

null :: SingObject s a -> Bool #

length :: SingObject s a -> Int #

elem :: Eq a => a -> SingObject s a -> Bool #

maximum :: Ord a => SingObject s a -> a #

minimum :: Ord a => SingObject s a -> a #

sum :: Num a => SingObject s a -> a #

product :: Num a => SingObject s a -> a #

Traversable (SingObject s) Source # 
Instance details

Defined in Data.Aeson.Extra.SingObject

Methods

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

sequenceA :: Applicative f => SingObject s (f a) -> f (SingObject s a) #

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

sequence :: Monad m => SingObject s (m a) -> m (SingObject s a) #

KnownSymbol s => ToJSON1 (SingObject s) Source # 
Instance details

Defined in Data.Aeson.Extra.SingObject

Methods

liftToJSON :: (a -> Value) -> ([a] -> Value) -> SingObject s a -> Value #

liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [SingObject s a] -> Value #

liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> SingObject s a -> Encoding #

liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [SingObject s a] -> Encoding #

KnownSymbol s => FromJSON1 (SingObject s) Source # 
Instance details

Defined in Data.Aeson.Extra.SingObject

Methods

liftParseJSON :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (SingObject s a) #

liftParseJSONList :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [SingObject s a] #

Eq a => Eq (SingObject s a) Source # 
Instance details

Defined in Data.Aeson.Extra.SingObject

Methods

(==) :: SingObject s a -> SingObject s a -> Bool #

(/=) :: SingObject s a -> SingObject s a -> Bool #

Ord a => Ord (SingObject s a) Source # 
Instance details

Defined in Data.Aeson.Extra.SingObject

Methods

compare :: SingObject s a -> SingObject s a -> Ordering #

(<) :: SingObject s a -> SingObject s a -> Bool #

(<=) :: SingObject s a -> SingObject s a -> Bool #

(>) :: SingObject s a -> SingObject s a -> Bool #

(>=) :: SingObject s a -> SingObject s a -> Bool #

max :: SingObject s a -> SingObject s a -> SingObject s a #

min :: SingObject s a -> SingObject s a -> SingObject s a #

Read a => Read (SingObject s a) Source # 
Instance details

Defined in Data.Aeson.Extra.SingObject

Show a => Show (SingObject s a) Source # 
Instance details

Defined in Data.Aeson.Extra.SingObject

Methods

showsPrec :: Int -> SingObject s a -> ShowS #

show :: SingObject s a -> String #

showList :: [SingObject s a] -> ShowS #

(KnownSymbol s, ToJSON a) => ToJSON (SingObject s a) Source # 
Instance details

Defined in Data.Aeson.Extra.SingObject

(KnownSymbol s, FromJSON a) => FromJSON (SingObject s a) Source # 
Instance details

Defined in Data.Aeson.Extra.SingObject

NFData a => NFData (SingObject s a) Source #

Since: 0.4.1.0

Instance details

Defined in Data.Aeson.Extra.SingObject

Methods

rnf :: SingObject s a -> () #