aeson-extra-0.4.1.1: Extra goodies for aeson

Data.Aeson.Extra.Recursive

Contents

Description

Helps writing recursive algorithms on Value, for example:

stripNulls :: Value -> Value
stripNulls = cata (embed . f)
where
f (ObjectF a) = ObjectF $HM.filter (== Null) a f x = x  Synopsis # Documentation data ValueF a Source # An algebra of Value Since: aeson-extra-0.3.1.0 Constructors  ObjectF (ObjectF a) ArrayF !(ArrayF a) StringF !Text NumberF !Scientific BoolF !Bool NullF Instances  Source # Methodsfmap :: (a -> b) -> ValueF a -> ValueF b #(<$) :: a -> ValueF b -> ValueF a # Source # Methodsfold :: Monoid m => ValueF m -> m #foldMap :: Monoid m => (a -> m) -> ValueF a -> m #foldr :: (a -> b -> b) -> b -> ValueF a -> b #foldr' :: (a -> b -> b) -> b -> ValueF a -> b #foldl :: (b -> a -> b) -> b -> ValueF a -> b #foldl' :: (b -> a -> b) -> b -> ValueF a -> b #foldr1 :: (a -> a -> a) -> ValueF a -> a #foldl1 :: (a -> a -> a) -> ValueF a -> a #toList :: ValueF a -> [a] #null :: ValueF a -> Bool #length :: ValueF a -> Int #elem :: Eq a => a -> ValueF a -> Bool #maximum :: Ord a => ValueF a -> a #minimum :: Ord a => ValueF a -> a #sum :: Num a => ValueF a -> a #product :: Num a => ValueF a -> a # Source # Methodstraverse :: Applicative f => (a -> f b) -> ValueF a -> f (ValueF b) #sequenceA :: Applicative f => ValueF (f a) -> f (ValueF a) #mapM :: Monad m => (a -> m b) -> ValueF a -> m (ValueF b) #sequence :: Monad m => ValueF (m a) -> m (ValueF a) # Eq a => Eq (ValueF a) Source # Methods(==) :: ValueF a -> ValueF a -> Bool #(/=) :: ValueF a -> ValueF a -> Bool # Data a => Data (ValueF a) Source # Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ValueF a -> c (ValueF a) #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ValueF a) #toConstr :: ValueF a -> Constr #dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (ValueF a)) #dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ValueF a)) #gmapT :: (forall b. Data b => b -> b) -> ValueF a -> ValueF a #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ValueF a -> r #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ValueF a -> r #gmapQ :: (forall d. Data d => d -> u) -> ValueF a -> [u] #gmapQi :: Int -> (forall d. Data d => d -> u) -> ValueF a -> u #gmapM :: Monad m => (forall d. Data d => d -> m d) -> ValueF a -> m (ValueF a) #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ValueF a -> m (ValueF a) #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ValueF a -> m (ValueF a) # Read a => Read (ValueF a) Source # MethodsreadsPrec :: Int -> ReadS (ValueF a) #readList :: ReadS [ValueF a] # Show a => Show (ValueF a) Source # MethodsshowsPrec :: Int -> ValueF a -> ShowS #show :: ValueF a -> String #showList :: [ValueF a] -> ShowS #

type ObjectF a = HashMap Text a Source #

A JSON "object" (key/value map).

Since: aeson-extra-0.3.1.0

type ArrayF a = Vector a Source #

A JSON "array" (sequence).

Since: aeson-extra-0.3.1.0

# Orphan instances

 Source # Methodscata :: (Base Value a -> a) -> Value -> a #para :: (Base Value (Value, a) -> a) -> Value -> a #gpara :: (Corecursive Value, Comonad w) => (forall b. Base Value (w b) -> w (Base Value b)) -> (Base Value (EnvT Value w a) -> a) -> Value -> a #prepro :: Corecursive Value => (forall b. Base Value b -> Base Value b) -> (Base Value a -> a) -> Value -> a #gprepro :: (Corecursive Value, Comonad w) => (forall b. Base Value (w b) -> w (Base Value b)) -> (forall c. Base Value c -> Base Value c) -> (Base Value (w a) -> a) -> Value -> a # Source # Methodsana :: (a -> Base Value a) -> a -> Value #apo :: (a -> Base Value (Either Value a)) -> a -> Value #postpro :: Recursive Value => (forall b. Base Value b -> Base Value b) -> (a -> Base Value a) -> a -> Value #gpostpro :: (Recursive Value, Monad m) => (forall b. m (Base Value b) -> Base Value (m b)) -> (forall c. Base Value c -> Base Value c) -> (a -> Base Value (m a)) -> a -> Value #