aeson-extra-0.5.1.2: Extra goodies for aeson

Copyright | (C) 2015-2016 Oleg Grenrus
License | BSD3
Maintainer | Oleg Grenrus <oleg.grenrus@iki.fi>
Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Aeson.Extra.Merge

Description

Synopsis

- merge :: (forall a. (a -> a -> a) -> ValueF a -> ValueF a -> ValueF a) -> Value -> Value -> Value
- mergeA :: Functor f => (forall a. (a -> a -> f a) -> ValueF a -> ValueF a -> f (ValueF a)) -> Value -> Value -> f Value
- lodashMerge :: Value -> Value -> Value
- data ValueF a
  - = ObjectF (ObjectF a)
  - | ArrayF !(ArrayF a)
  - | StringF !Text
  - | NumberF !Scientific
  - | BoolF !Bool
  - | NullF
- type ObjectF a = HashMap Text a
- type ArrayF a = Vector a

# Documentation

merge :: (forall a. (a -> a -> a) -> ValueF a -> ValueF a -> ValueF a) -> Value -> Value -> Value Source #

Generic merge.

For example see `lodashMerge`.

Since: aeson-extra-0.3.1.0

mergeA :: Functor f => (forall a. (a -> a -> f a) -> ValueF a -> ValueF a -> f (ValueF a)) -> Value -> Value -> f Value Source #

Generic merge, in arbitrary context.

Since: aeson-extra-0.3.1.0

lodashMerge :: Value -> Value -> Value Source #

Example of using `merge`. see https://lodash.com/docs#merge:

Note: not tested against JavaScript lodash, so may disagree in the results.

Since: 0.4.1.0

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

Instances details

Foldable ValueF Source # |

Instance details

Defined in Data.Aeson.Extra.Recursive

Methods

fold :: Monoid m => ValueF m -> m Source #

foldMap :: Monoid m => (a -> m) -> ValueF a -> m Source #

foldMap' :: Monoid m => (a -> m) -> ValueF a -> m Source #

foldr :: (a -> b -> b) -> b -> ValueF a -> b Source #

foldr' :: (a -> b -> b) -> b -> ValueF a -> b Source #

foldl :: (b -> a -> b) -> b -> ValueF a -> b Source #

foldl' :: (b -> a -> b) -> b -> ValueF a -> b Source #

foldr1 :: (a -> a -> a) -> ValueF a -> a Source #

foldl1 :: (a -> a -> a) -> ValueF a -> a Source #

toList :: ValueF a -> [a] Source #

null :: ValueF a -> Bool Source #

length :: ValueF a -> Int Source #

elem :: Eq a => a -> ValueF a -> Bool Source #

maximum :: Ord a => ValueF a -> a Source #

minimum :: Ord a => ValueF a -> a Source #

sum :: Num a => ValueF a -> a Source #

product :: Num a => ValueF a -> a Source #

Traversable ValueF Source # |
Instance details Defined in Data.Aeson.Extra.Recursive Methods traverse :: Applicative f => (a -> f b) -> ValueF a -> f (ValueF b) Source # sequenceA :: Applicative f => ValueF (f a) -> f (ValueF a) Source # mapM :: Monad m => (a -> m b) -> ValueF a -> m (ValueF b) Source # sequence :: Monad m => ValueF (m a) -> m (ValueF a) Source #
Functor ValueF Source # |
Instance details Defined in Data.Aeson.Extra.Recursive Methods fmap :: (a -> b) -> ValueF a -> ValueF b Source # (<$) :: a -> ValueF b -> ValueF a Source #
Data a => Data (ValueF a) Source # |

Instance details

Defined in Data.Aeson.Extra.Recursive

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ValueF a -> c (ValueF a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ValueF a) Source #

toConstr :: ValueF a -> Constr Source #

dataTypeOf :: ValueF a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ValueF a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ValueF a)) Source #

gmapT :: (forall b. Data b => b -> b) -> ValueF a -> ValueF a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ValueF a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ValueF a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> ValueF a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ValueF a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ValueF a -> m (ValueF a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ValueF a -> m (ValueF a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ValueF a -> m (ValueF a) Source #

Read a => Read (ValueF a) Source # |
Instance details Defined in Data.Aeson.Extra.Recursive Methods readsPrec :: Int -> ReadS (ValueF a) Source # readList :: ReadS [ValueF a] Source # readPrec :: ReadPrec (ValueF a) Source # readListPrec :: ReadPrec [ValueF a] Source #
Show a => Show (ValueF a) Source # |
Instance details Defined in Data.Aeson.Extra.Recursive Methods showsPrec :: Int -> ValueF a -> ShowS Source # show :: ValueF a -> String Source # showList :: [ValueF a] -> ShowS Source #
Eq a => Eq (ValueF a) Source # |
Instance details Defined in Data.Aeson.Extra.Recursive Methods (==) :: ValueF a -> ValueF a -> Bool Source # (/=) :: ValueF a -> ValueF a -> Bool Source #

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