{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
module Waargonaut.Types.JObject.JAssoc
(
JAssoc (..)
, HasJAssoc (..)
, parseJAssoc
, jAssocAlterF
) where
import Prelude (Eq, Show)
import Control.Applicative ((<*), (<*>))
import Control.Category (id, (.))
import Control.Lens (Lens', ( # ), (.~))
import Control.Monad (Monad)
import Data.Bifoldable (Bifoldable (bifoldMap))
import Data.Bifunctor (Bifunctor (bimap))
import Data.Bitraversable (Bitraversable (bitraverse))
import Data.Foldable (Foldable)
import Data.Functor (Functor, fmap, (<$>))
import Data.Maybe (Maybe (..), maybe)
import Data.Monoid (Monoid (mappend, mempty))
import Data.Text (Text)
import Data.Traversable (Traversable)
import Text.Parser.Char (CharParsing, char)
import Waargonaut.Types.JString (JString,
parseJString, _JStringText)
data JAssoc ws a = JAssoc
{ JAssoc ws a -> JString
_jsonAssocKey :: JString
, JAssoc ws a -> ws
_jsonAssocKeyTrailingWS :: ws
, JAssoc ws a -> ws
_jsonAssocValPreceedingWS :: ws
, JAssoc ws a -> a
_jsonAssocVal :: a
}
deriving (JAssoc ws a -> JAssoc ws a -> Bool
(JAssoc ws a -> JAssoc ws a -> Bool)
-> (JAssoc ws a -> JAssoc ws a -> Bool) -> Eq (JAssoc ws a)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall ws a. (Eq ws, Eq a) => JAssoc ws a -> JAssoc ws a -> Bool
/= :: JAssoc ws a -> JAssoc ws a -> Bool
$c/= :: forall ws a. (Eq ws, Eq a) => JAssoc ws a -> JAssoc ws a -> Bool
== :: JAssoc ws a -> JAssoc ws a -> Bool
$c== :: forall ws a. (Eq ws, Eq a) => JAssoc ws a -> JAssoc ws a -> Bool
Eq, Int -> JAssoc ws a -> ShowS
[JAssoc ws a] -> ShowS
JAssoc ws a -> String
(Int -> JAssoc ws a -> ShowS)
-> (JAssoc ws a -> String)
-> ([JAssoc ws a] -> ShowS)
-> Show (JAssoc ws a)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall ws a. (Show ws, Show a) => Int -> JAssoc ws a -> ShowS
forall ws a. (Show ws, Show a) => [JAssoc ws a] -> ShowS
forall ws a. (Show ws, Show a) => JAssoc ws a -> String
showList :: [JAssoc ws a] -> ShowS
$cshowList :: forall ws a. (Show ws, Show a) => [JAssoc ws a] -> ShowS
show :: JAssoc ws a -> String
$cshow :: forall ws a. (Show ws, Show a) => JAssoc ws a -> String
showsPrec :: Int -> JAssoc ws a -> ShowS
$cshowsPrec :: forall ws a. (Show ws, Show a) => Int -> JAssoc ws a -> ShowS
Show, a -> JAssoc ws b -> JAssoc ws a
(a -> b) -> JAssoc ws a -> JAssoc ws b
(forall a b. (a -> b) -> JAssoc ws a -> JAssoc ws b)
-> (forall a b. a -> JAssoc ws b -> JAssoc ws a)
-> Functor (JAssoc ws)
forall a b. a -> JAssoc ws b -> JAssoc ws a
forall a b. (a -> b) -> JAssoc ws a -> JAssoc ws b
forall ws a b. a -> JAssoc ws b -> JAssoc ws a
forall ws a b. (a -> b) -> JAssoc ws a -> JAssoc ws b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> JAssoc ws b -> JAssoc ws a
$c<$ :: forall ws a b. a -> JAssoc ws b -> JAssoc ws a
fmap :: (a -> b) -> JAssoc ws a -> JAssoc ws b
$cfmap :: forall ws a b. (a -> b) -> JAssoc ws a -> JAssoc ws b
Functor, JAssoc ws a -> Bool
(a -> m) -> JAssoc ws a -> m
(a -> b -> b) -> b -> JAssoc ws a -> b
(forall m. Monoid m => JAssoc ws m -> m)
-> (forall m a. Monoid m => (a -> m) -> JAssoc ws a -> m)
-> (forall m a. Monoid m => (a -> m) -> JAssoc ws a -> m)
-> (forall a b. (a -> b -> b) -> b -> JAssoc ws a -> b)
-> (forall a b. (a -> b -> b) -> b -> JAssoc ws a -> b)
-> (forall b a. (b -> a -> b) -> b -> JAssoc ws a -> b)
-> (forall b a. (b -> a -> b) -> b -> JAssoc ws a -> b)
-> (forall a. (a -> a -> a) -> JAssoc ws a -> a)
-> (forall a. (a -> a -> a) -> JAssoc ws a -> a)
-> (forall a. JAssoc ws a -> [a])
-> (forall a. JAssoc ws a -> Bool)
-> (forall a. JAssoc ws a -> Int)
-> (forall a. Eq a => a -> JAssoc ws a -> Bool)
-> (forall a. Ord a => JAssoc ws a -> a)
-> (forall a. Ord a => JAssoc ws a -> a)
-> (forall a. Num a => JAssoc ws a -> a)
-> (forall a. Num a => JAssoc ws a -> a)
-> Foldable (JAssoc ws)
forall a. Eq a => a -> JAssoc ws a -> Bool
forall a. Num a => JAssoc ws a -> a
forall a. Ord a => JAssoc ws a -> a
forall m. Monoid m => JAssoc ws m -> m
forall a. JAssoc ws a -> Bool
forall a. JAssoc ws a -> Int
forall a. JAssoc ws a -> [a]
forall a. (a -> a -> a) -> JAssoc ws a -> a
forall ws a. Eq a => a -> JAssoc ws a -> Bool
forall ws a. Num a => JAssoc ws a -> a
forall ws a. Ord a => JAssoc ws a -> a
forall m a. Monoid m => (a -> m) -> JAssoc ws a -> m
forall ws m. Monoid m => JAssoc ws m -> m
forall ws a. JAssoc ws a -> Bool
forall ws a. JAssoc ws a -> Int
forall ws a. JAssoc ws a -> [a]
forall b a. (b -> a -> b) -> b -> JAssoc ws a -> b
forall a b. (a -> b -> b) -> b -> JAssoc ws a -> b
forall ws a. (a -> a -> a) -> JAssoc ws a -> a
forall ws m a. Monoid m => (a -> m) -> JAssoc ws a -> m
forall ws b a. (b -> a -> b) -> b -> JAssoc ws a -> b
forall ws a b. (a -> b -> b) -> b -> JAssoc ws a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: JAssoc ws a -> a
$cproduct :: forall ws a. Num a => JAssoc ws a -> a
sum :: JAssoc ws a -> a
$csum :: forall ws a. Num a => JAssoc ws a -> a
minimum :: JAssoc ws a -> a
$cminimum :: forall ws a. Ord a => JAssoc ws a -> a
maximum :: JAssoc ws a -> a
$cmaximum :: forall ws a. Ord a => JAssoc ws a -> a
elem :: a -> JAssoc ws a -> Bool
$celem :: forall ws a. Eq a => a -> JAssoc ws a -> Bool
length :: JAssoc ws a -> Int
$clength :: forall ws a. JAssoc ws a -> Int
null :: JAssoc ws a -> Bool
$cnull :: forall ws a. JAssoc ws a -> Bool
toList :: JAssoc ws a -> [a]
$ctoList :: forall ws a. JAssoc ws a -> [a]
foldl1 :: (a -> a -> a) -> JAssoc ws a -> a
$cfoldl1 :: forall ws a. (a -> a -> a) -> JAssoc ws a -> a
foldr1 :: (a -> a -> a) -> JAssoc ws a -> a
$cfoldr1 :: forall ws a. (a -> a -> a) -> JAssoc ws a -> a
foldl' :: (b -> a -> b) -> b -> JAssoc ws a -> b
$cfoldl' :: forall ws b a. (b -> a -> b) -> b -> JAssoc ws a -> b
foldl :: (b -> a -> b) -> b -> JAssoc ws a -> b
$cfoldl :: forall ws b a. (b -> a -> b) -> b -> JAssoc ws a -> b
foldr' :: (a -> b -> b) -> b -> JAssoc ws a -> b
$cfoldr' :: forall ws a b. (a -> b -> b) -> b -> JAssoc ws a -> b
foldr :: (a -> b -> b) -> b -> JAssoc ws a -> b
$cfoldr :: forall ws a b. (a -> b -> b) -> b -> JAssoc ws a -> b
foldMap' :: (a -> m) -> JAssoc ws a -> m
$cfoldMap' :: forall ws m a. Monoid m => (a -> m) -> JAssoc ws a -> m
foldMap :: (a -> m) -> JAssoc ws a -> m
$cfoldMap :: forall ws m a. Monoid m => (a -> m) -> JAssoc ws a -> m
fold :: JAssoc ws m -> m
$cfold :: forall ws m. Monoid m => JAssoc ws m -> m
Foldable, Functor (JAssoc ws)
Foldable (JAssoc ws)
Functor (JAssoc ws)
-> Foldable (JAssoc ws)
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> JAssoc ws a -> f (JAssoc ws b))
-> (forall (f :: * -> *) a.
Applicative f =>
JAssoc ws (f a) -> f (JAssoc ws a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> JAssoc ws a -> m (JAssoc ws b))
-> (forall (m :: * -> *) a.
Monad m =>
JAssoc ws (m a) -> m (JAssoc ws a))
-> Traversable (JAssoc ws)
(a -> f b) -> JAssoc ws a -> f (JAssoc ws b)
forall ws. Functor (JAssoc ws)
forall ws. Foldable (JAssoc ws)
forall ws (m :: * -> *) a.
Monad m =>
JAssoc ws (m a) -> m (JAssoc ws a)
forall ws (f :: * -> *) a.
Applicative f =>
JAssoc ws (f a) -> f (JAssoc ws a)
forall ws (m :: * -> *) a b.
Monad m =>
(a -> m b) -> JAssoc ws a -> m (JAssoc ws b)
forall ws (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> JAssoc ws a -> f (JAssoc ws b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
JAssoc ws (m a) -> m (JAssoc ws a)
forall (f :: * -> *) a.
Applicative f =>
JAssoc ws (f a) -> f (JAssoc ws a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> JAssoc ws a -> m (JAssoc ws b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> JAssoc ws a -> f (JAssoc ws b)
sequence :: JAssoc ws (m a) -> m (JAssoc ws a)
$csequence :: forall ws (m :: * -> *) a.
Monad m =>
JAssoc ws (m a) -> m (JAssoc ws a)
mapM :: (a -> m b) -> JAssoc ws a -> m (JAssoc ws b)
$cmapM :: forall ws (m :: * -> *) a b.
Monad m =>
(a -> m b) -> JAssoc ws a -> m (JAssoc ws b)
sequenceA :: JAssoc ws (f a) -> f (JAssoc ws a)
$csequenceA :: forall ws (f :: * -> *) a.
Applicative f =>
JAssoc ws (f a) -> f (JAssoc ws a)
traverse :: (a -> f b) -> JAssoc ws a -> f (JAssoc ws b)
$ctraverse :: forall ws (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> JAssoc ws a -> f (JAssoc ws b)
$cp2Traversable :: forall ws. Foldable (JAssoc ws)
$cp1Traversable :: forall ws. Functor (JAssoc ws)
Traversable)
instance Bifunctor JAssoc where
bimap :: (a -> b) -> (c -> d) -> JAssoc a c -> JAssoc b d
bimap a -> b
f c -> d
g (JAssoc JString
k a
w1 a
w2 c
v) = JString -> b -> b -> d -> JAssoc b d
forall ws a. JString -> ws -> ws -> a -> JAssoc ws a
JAssoc JString
k (a -> b
f a
w1) (a -> b
f a
w2) (c -> d
g c
v)
instance Bifoldable JAssoc where
bifoldMap :: (a -> m) -> (b -> m) -> JAssoc a b -> m
bifoldMap a -> m
f b -> m
g (JAssoc JString
_ a
w1 a
w2 b
v) = a -> m
f a
w1 m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` a -> m
f a
w2 m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` b -> m
g b
v
instance Bitraversable JAssoc where
bitraverse :: (a -> f c) -> (b -> f d) -> JAssoc a b -> f (JAssoc c d)
bitraverse a -> f c
f b -> f d
g (JAssoc JString
k a
w1 a
w2 b
v) = JString -> c -> c -> d -> JAssoc c d
forall ws a. JString -> ws -> ws -> a -> JAssoc ws a
JAssoc JString
k (c -> c -> d -> JAssoc c d) -> f c -> f (c -> d -> JAssoc c d)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f c
f a
w1 f (c -> d -> JAssoc c d) -> f c -> f (d -> JAssoc c d)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f c
f a
w2 f (d -> JAssoc c d) -> f d -> f (JAssoc c d)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> b -> f d
g b
v
class HasJAssoc c ws a | c -> ws a where
jAssoc :: Lens' c (JAssoc ws a)
jsonAssocKey :: Lens' c JString
{-# INLINE jsonAssocKey #-}
jsonAssocKeyTrailingWS :: Lens' c ws
{-# INLINE jsonAssocKeyTrailingWS #-}
jsonAssocVal :: Lens' c a
{-# INLINE jsonAssocVal #-}
jsonAssocValPreceedingWS :: Lens' c ws
{-# INLINE jsonAssocValPreceedingWS #-}
jsonAssocKey = (JAssoc ws a -> f (JAssoc ws a)) -> c -> f c
forall c ws a. HasJAssoc c ws a => Lens' c (JAssoc ws a)
jAssoc ((JAssoc ws a -> f (JAssoc ws a)) -> c -> f c)
-> ((JString -> f JString) -> JAssoc ws a -> f (JAssoc ws a))
-> (JString -> f JString)
-> c
-> f c
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (JString -> f JString) -> JAssoc ws a -> f (JAssoc ws a)
forall c ws a. HasJAssoc c ws a => Lens' c JString
jsonAssocKey
jsonAssocKeyTrailingWS = (JAssoc ws a -> f (JAssoc ws a)) -> c -> f c
forall c ws a. HasJAssoc c ws a => Lens' c (JAssoc ws a)
jAssoc ((JAssoc ws a -> f (JAssoc ws a)) -> c -> f c)
-> ((ws -> f ws) -> JAssoc ws a -> f (JAssoc ws a))
-> (ws -> f ws)
-> c
-> f c
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (ws -> f ws) -> JAssoc ws a -> f (JAssoc ws a)
forall c ws a. HasJAssoc c ws a => Lens' c ws
jsonAssocKeyTrailingWS
jsonAssocVal = (JAssoc ws a -> f (JAssoc ws a)) -> c -> f c
forall c ws a. HasJAssoc c ws a => Lens' c (JAssoc ws a)
jAssoc ((JAssoc ws a -> f (JAssoc ws a)) -> c -> f c)
-> ((a -> f a) -> JAssoc ws a -> f (JAssoc ws a))
-> (a -> f a)
-> c
-> f c
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (a -> f a) -> JAssoc ws a -> f (JAssoc ws a)
forall c ws a. HasJAssoc c ws a => Lens' c a
jsonAssocVal
jsonAssocValPreceedingWS = (JAssoc ws a -> f (JAssoc ws a)) -> c -> f c
forall c ws a. HasJAssoc c ws a => Lens' c (JAssoc ws a)
jAssoc ((JAssoc ws a -> f (JAssoc ws a)) -> c -> f c)
-> ((ws -> f ws) -> JAssoc ws a -> f (JAssoc ws a))
-> (ws -> f ws)
-> c
-> f c
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (ws -> f ws) -> JAssoc ws a -> f (JAssoc ws a)
forall c ws a. HasJAssoc c ws a => Lens' c ws
jsonAssocValPreceedingWS
instance HasJAssoc (JAssoc ws a) ws a where
jAssoc :: (JAssoc ws a -> f (JAssoc ws a)) -> JAssoc ws a -> f (JAssoc ws a)
jAssoc = (JAssoc ws a -> f (JAssoc ws a)) -> JAssoc ws a -> f (JAssoc ws a)
forall k (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
jsonAssocKey :: (JString -> f JString) -> JAssoc ws a -> f (JAssoc ws a)
jsonAssocKey JString -> f JString
f (JAssoc JString
x1 ws
x2 ws
x3 a
x4) = (JString -> JAssoc ws a) -> f JString -> f (JAssoc ws a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\JString
y1 -> JString -> ws -> ws -> a -> JAssoc ws a
forall ws a. JString -> ws -> ws -> a -> JAssoc ws a
JAssoc JString
y1 ws
x2 ws
x3 a
x4) (JString -> f JString
f JString
x1)
{-# INLINE jsonAssocKey #-}
jsonAssocKeyTrailingWS :: (ws -> f ws) -> JAssoc ws a -> f (JAssoc ws a)
jsonAssocKeyTrailingWS ws -> f ws
f (JAssoc JString
x1 ws
x2 ws
x3 a
x4) = (ws -> JAssoc ws a) -> f ws -> f (JAssoc ws a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\ws
y1 -> JString -> ws -> ws -> a -> JAssoc ws a
forall ws a. JString -> ws -> ws -> a -> JAssoc ws a
JAssoc JString
x1 ws
y1 ws
x3 a
x4) (ws -> f ws
f ws
x2)
{-# INLINE jsonAssocKeyTrailingWS #-}
jsonAssocVal :: (a -> f a) -> JAssoc ws a -> f (JAssoc ws a)
jsonAssocVal a -> f a
f (JAssoc JString
x1 ws
x2 ws
x3 a
x4) = (a -> JAssoc ws a) -> f a -> f (JAssoc ws a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (JString -> ws -> ws -> a -> JAssoc ws a
forall ws a. JString -> ws -> ws -> a -> JAssoc ws a
JAssoc JString
x1 ws
x2 ws
x3) (a -> f a
f a
x4)
{-# INLINE jsonAssocVal #-}
jsonAssocValPreceedingWS :: (ws -> f ws) -> JAssoc ws a -> f (JAssoc ws a)
jsonAssocValPreceedingWS ws -> f ws
f (JAssoc JString
x1 ws
x2 ws
x3 a
x4) = (ws -> JAssoc ws a) -> f ws -> f (JAssoc ws a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\ws
y1 -> JString -> ws -> ws -> a -> JAssoc ws a
forall ws a. JString -> ws -> ws -> a -> JAssoc ws a
JAssoc JString
x1 ws
x2 ws
y1 a
x4) (ws -> f ws
f ws
x3)
{-# INLINE jsonAssocValPreceedingWS #-}
jAssocAlterF
:: ( Monoid ws
, Functor f
)
=> Text
-> (Maybe a -> f (Maybe a))
-> Maybe (JAssoc ws a)
-> f (Maybe (JAssoc ws a))
jAssocAlterF :: Text
-> (Maybe a -> f (Maybe a))
-> Maybe (JAssoc ws a)
-> f (Maybe (JAssoc ws a))
jAssocAlterF Text
k Maybe a -> f (Maybe a)
f Maybe (JAssoc ws a)
mja = (a -> JAssoc ws a) -> Maybe a -> Maybe (JAssoc ws a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> JAssoc ws a
g (Maybe a -> Maybe (JAssoc ws a))
-> f (Maybe a) -> f (Maybe (JAssoc ws a))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe a -> f (Maybe a)
f (JAssoc ws a -> a
forall ws a. JAssoc ws a -> a
_jsonAssocVal (JAssoc ws a -> a) -> Maybe (JAssoc ws a) -> Maybe a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (JAssoc ws a)
mja) where
g :: a -> JAssoc ws a
g a
v = JAssoc ws a
-> (JAssoc ws a -> JAssoc ws a)
-> Maybe (JAssoc ws a)
-> JAssoc ws a
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (JString -> ws -> ws -> a -> JAssoc ws a
forall ws a. JString -> ws -> ws -> a -> JAssoc ws a
JAssoc (Tagged Text (Identity Text) -> Tagged JString (Identity JString)
forall (p :: * -> * -> *) (f :: * -> *).
(Profunctor p, Applicative f) =>
p Text (f Text) -> p JString (f JString)
_JStringText (Tagged Text (Identity Text) -> Tagged JString (Identity JString))
-> Text -> JString
forall t b. AReview t b -> b -> t
# Text
k) ws
forall a. Monoid a => a
mempty ws
forall a. Monoid a => a
mempty a
v) ((a -> Identity a) -> JAssoc ws a -> Identity (JAssoc ws a)
forall c ws a. HasJAssoc c ws a => Lens' c a
jsonAssocVal ((a -> Identity a) -> JAssoc ws a -> Identity (JAssoc ws a))
-> a -> JAssoc ws a -> JAssoc ws a
forall s t a b. ASetter s t a b -> b -> s -> t
.~ a
v) Maybe (JAssoc ws a)
mja
parseJAssoc
:: ( Monad f
, CharParsing f
)
=> f ws
-> f a
-> f (JAssoc ws a)
parseJAssoc :: f ws -> f a -> f (JAssoc ws a)
parseJAssoc f ws
ws f a
a = JString -> ws -> ws -> a -> JAssoc ws a
forall ws a. JString -> ws -> ws -> a -> JAssoc ws a
JAssoc
(JString -> ws -> ws -> a -> JAssoc ws a)
-> f JString -> f (ws -> ws -> a -> JAssoc ws a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f JString
forall (f :: * -> *). CharParsing f => f JString
parseJString f (ws -> ws -> a -> JAssoc ws a)
-> f ws -> f (ws -> a -> JAssoc ws a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> f ws
ws f (ws -> a -> JAssoc ws a) -> f Char -> f (ws -> a -> JAssoc ws a)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Char -> f Char
forall (m :: * -> *). CharParsing m => Char -> m Char
char Char
':' f (ws -> a -> JAssoc ws a) -> f ws -> f (a -> JAssoc ws a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> f ws
ws f (a -> JAssoc ws a) -> f a -> f (JAssoc ws a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> f a
a