{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DerivingStrategies #-} module Data.Medea.ValidJSON (ValidJSONF (..)) where import Control.DeepSeq (NFData (..)) import Data.Aeson (Value (..)) import Data.Data (Data) import Data.Functor.Classes (Eq1 (..), Show1 (..)) import Data.HashMap.Strict (HashMap) import Data.Hashable (Hashable (..)) import Data.Scientific (Scientific) import Data.Text (Text) import Data.Typeable (Typeable) import Data.Vector (Vector) import Data.Vector.Instances () data ValidJSONF a = AnythingF !Value | NullF | BooleanF !Bool | NumberF {-# UNPACK #-} !Scientific | StringF {-# UNPACK #-} !Text | ArrayF {-# UNPACK #-} !(Vector a) | ObjectF !(HashMap Text a) deriving stock (a -> ValidJSONF b -> ValidJSONF a (a -> b) -> ValidJSONF a -> ValidJSONF b (forall a b. (a -> b) -> ValidJSONF a -> ValidJSONF b) -> (forall a b. a -> ValidJSONF b -> ValidJSONF a) -> Functor ValidJSONF forall a b. a -> ValidJSONF b -> ValidJSONF a forall a b. (a -> b) -> ValidJSONF a -> ValidJSONF b forall (f :: * -> *). (forall a b. (a -> b) -> f a -> f b) -> (forall a b. a -> f b -> f a) -> Functor f <$ :: a -> ValidJSONF b -> ValidJSONF a $c<$ :: forall a b. a -> ValidJSONF b -> ValidJSONF a fmap :: (a -> b) -> ValidJSONF a -> ValidJSONF b $cfmap :: forall a b. (a -> b) -> ValidJSONF a -> ValidJSONF b Functor, Typeable, Typeable (ValidJSONF a) DataType Constr Typeable (ValidJSONF a) -> (forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ValidJSONF a -> c (ValidJSONF a)) -> (forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ValidJSONF a)) -> (ValidJSONF a -> Constr) -> (ValidJSONF a -> DataType) -> (forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ValidJSONF a))) -> (forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ValidJSONF a))) -> ((forall b. Data b => b -> b) -> ValidJSONF a -> ValidJSONF a) -> (forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ValidJSONF a -> r) -> (forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ValidJSONF a -> r) -> (forall u. (forall d. Data d => d -> u) -> ValidJSONF a -> [u]) -> (forall u. Int -> (forall d. Data d => d -> u) -> ValidJSONF a -> u) -> (forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> ValidJSONF a -> m (ValidJSONF a)) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> ValidJSONF a -> m (ValidJSONF a)) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> ValidJSONF a -> m (ValidJSONF a)) -> Data (ValidJSONF a) ValidJSONF a -> DataType ValidJSONF a -> Constr (forall d. Data d => c (t d)) -> Maybe (c (ValidJSONF a)) (forall b. Data b => b -> b) -> ValidJSONF a -> ValidJSONF a (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ValidJSONF a -> c (ValidJSONF a) (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ValidJSONF a) forall a. Data a => Typeable (ValidJSONF a) forall a. Data a => ValidJSONF a -> DataType forall a. Data a => ValidJSONF a -> Constr forall a. Data a => (forall b. Data b => b -> b) -> ValidJSONF a -> ValidJSONF a forall a u. Data a => Int -> (forall d. Data d => d -> u) -> ValidJSONF a -> u forall a u. Data a => (forall d. Data d => d -> u) -> ValidJSONF a -> [u] forall a r r'. Data a => (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ValidJSONF a -> r forall a r r'. Data a => (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ValidJSONF a -> r forall a (m :: * -> *). (Data a, Monad m) => (forall d. Data d => d -> m d) -> ValidJSONF a -> m (ValidJSONF a) forall a (m :: * -> *). (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> ValidJSONF a -> m (ValidJSONF a) forall a (c :: * -> *). Data a => (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ValidJSONF a) forall a (c :: * -> *). Data a => (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ValidJSONF a -> c (ValidJSONF a) forall a (t :: * -> *) (c :: * -> *). (Data a, Typeable t) => (forall d. Data d => c (t d)) -> Maybe (c (ValidJSONF a)) forall a (t :: * -> * -> *) (c :: * -> *). (Data a, Typeable t) => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ValidJSONF a)) forall a. Typeable a -> (forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> a -> c a) -> (forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c a) -> (a -> Constr) -> (a -> DataType) -> (forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c a)) -> (forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a)) -> ((forall b. Data b => b -> b) -> a -> a) -> (forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r) -> (forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r) -> (forall u. (forall d. Data d => d -> u) -> a -> [u]) -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u) -> (forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> a -> m a) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a) -> Data a forall u. Int -> (forall d. Data d => d -> u) -> ValidJSONF a -> u forall u. (forall d. Data d => d -> u) -> ValidJSONF a -> [u] forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ValidJSONF a -> r forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ValidJSONF a -> r forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> ValidJSONF a -> m (ValidJSONF a) forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> ValidJSONF a -> m (ValidJSONF a) forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ValidJSONF a) forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ValidJSONF a -> c (ValidJSONF a) forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ValidJSONF a)) forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ValidJSONF a)) $cObjectF :: Constr $cArrayF :: Constr $cStringF :: Constr $cNumberF :: Constr $cBooleanF :: Constr $cNullF :: Constr $cAnythingF :: Constr $tValidJSONF :: DataType gmapMo :: (forall d. Data d => d -> m d) -> ValidJSONF a -> m (ValidJSONF a) $cgmapMo :: forall a (m :: * -> *). (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> ValidJSONF a -> m (ValidJSONF a) gmapMp :: (forall d. Data d => d -> m d) -> ValidJSONF a -> m (ValidJSONF a) $cgmapMp :: forall a (m :: * -> *). (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> ValidJSONF a -> m (ValidJSONF a) gmapM :: (forall d. Data d => d -> m d) -> ValidJSONF a -> m (ValidJSONF a) $cgmapM :: forall a (m :: * -> *). (Data a, Monad m) => (forall d. Data d => d -> m d) -> ValidJSONF a -> m (ValidJSONF a) gmapQi :: Int -> (forall d. Data d => d -> u) -> ValidJSONF a -> u $cgmapQi :: forall a u. Data a => Int -> (forall d. Data d => d -> u) -> ValidJSONF a -> u gmapQ :: (forall d. Data d => d -> u) -> ValidJSONF a -> [u] $cgmapQ :: forall a u. Data a => (forall d. Data d => d -> u) -> ValidJSONF a -> [u] gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ValidJSONF a -> r $cgmapQr :: forall a r r'. Data a => (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ValidJSONF a -> r gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ValidJSONF a -> r $cgmapQl :: forall a r r'. Data a => (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ValidJSONF a -> r gmapT :: (forall b. Data b => b -> b) -> ValidJSONF a -> ValidJSONF a $cgmapT :: forall a. Data a => (forall b. Data b => b -> b) -> ValidJSONF a -> ValidJSONF a dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ValidJSONF a)) $cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *). (Data a, Typeable t) => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ValidJSONF a)) dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (ValidJSONF a)) $cdataCast1 :: forall a (t :: * -> *) (c :: * -> *). (Data a, Typeable t) => (forall d. Data d => c (t d)) -> Maybe (c (ValidJSONF a)) dataTypeOf :: ValidJSONF a -> DataType $cdataTypeOf :: forall a. Data a => ValidJSONF a -> DataType toConstr :: ValidJSONF a -> Constr $ctoConstr :: forall a. Data a => ValidJSONF a -> Constr gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ValidJSONF a) $cgunfold :: forall a (c :: * -> *). Data a => (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ValidJSONF a) gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ValidJSONF a -> c (ValidJSONF a) $cgfoldl :: forall a (c :: * -> *). Data a => (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ValidJSONF a -> c (ValidJSONF a) $cp1Data :: forall a. Data a => Typeable (ValidJSONF a) Data) instance Foldable ValidJSONF where {-# INLINE foldMap #-} foldMap :: (a -> m) -> ValidJSONF a -> m foldMap a -> m _ (AnythingF Value _) = m forall a. Monoid a => a mempty foldMap a -> m _ ValidJSONF a NullF = m forall a. Monoid a => a mempty foldMap a -> m _ (BooleanF Bool _) = m forall a. Monoid a => a mempty foldMap a -> m _ (NumberF Scientific _) = m forall a. Monoid a => a mempty foldMap a -> m _ (StringF Text _) = m forall a. Monoid a => a mempty foldMap a -> m f (ArrayF Vector a v) = (a -> m) -> Vector a -> m forall (t :: * -> *) m a. (Foldable t, Monoid m) => (a -> m) -> t a -> m foldMap a -> m f Vector a v foldMap a -> m f (ObjectF HashMap Text a hm) = (a -> m) -> HashMap Text a -> m forall (t :: * -> *) m a. (Foldable t, Monoid m) => (a -> m) -> t a -> m foldMap a -> m f HashMap Text a hm instance Traversable ValidJSONF where {-# INLINE traverse #-} traverse :: (a -> f b) -> ValidJSONF a -> f (ValidJSONF b) traverse a -> f b _ (AnythingF Value v) = ValidJSONF b -> f (ValidJSONF b) forall (f :: * -> *) a. Applicative f => a -> f a pure (ValidJSONF b -> f (ValidJSONF b)) -> (Value -> ValidJSONF b) -> Value -> f (ValidJSONF b) forall b c a. (b -> c) -> (a -> b) -> a -> c . Value -> ValidJSONF b forall a. Value -> ValidJSONF a AnythingF (Value -> f (ValidJSONF b)) -> Value -> f (ValidJSONF b) forall a b. (a -> b) -> a -> b $ Value v traverse a -> f b _ ValidJSONF a NullF = ValidJSONF b -> f (ValidJSONF b) forall (f :: * -> *) a. Applicative f => a -> f a pure ValidJSONF b forall a. ValidJSONF a NullF traverse a -> f b _ (BooleanF Bool b) = ValidJSONF b -> f (ValidJSONF b) forall (f :: * -> *) a. Applicative f => a -> f a pure (ValidJSONF b -> f (ValidJSONF b)) -> (Bool -> ValidJSONF b) -> Bool -> f (ValidJSONF b) forall b c a. (b -> c) -> (a -> b) -> a -> c . Bool -> ValidJSONF b forall a. Bool -> ValidJSONF a BooleanF (Bool -> f (ValidJSONF b)) -> Bool -> f (ValidJSONF b) forall a b. (a -> b) -> a -> b $ Bool b traverse a -> f b _ (NumberF Scientific n) = ValidJSONF b -> f (ValidJSONF b) forall (f :: * -> *) a. Applicative f => a -> f a pure (ValidJSONF b -> f (ValidJSONF b)) -> (Scientific -> ValidJSONF b) -> Scientific -> f (ValidJSONF b) forall b c a. (b -> c) -> (a -> b) -> a -> c . Scientific -> ValidJSONF b forall a. Scientific -> ValidJSONF a NumberF (Scientific -> f (ValidJSONF b)) -> Scientific -> f (ValidJSONF b) forall a b. (a -> b) -> a -> b $ Scientific n traverse a -> f b _ (StringF Text s) = ValidJSONF b -> f (ValidJSONF b) forall (f :: * -> *) a. Applicative f => a -> f a pure (ValidJSONF b -> f (ValidJSONF b)) -> (Text -> ValidJSONF b) -> Text -> f (ValidJSONF b) forall b c a. (b -> c) -> (a -> b) -> a -> c . Text -> ValidJSONF b forall a. Text -> ValidJSONF a StringF (Text -> f (ValidJSONF b)) -> Text -> f (ValidJSONF b) forall a b. (a -> b) -> a -> b $ Text s traverse a -> f b f (ArrayF Vector a v) = Vector b -> ValidJSONF b forall a. Vector a -> ValidJSONF a ArrayF (Vector b -> ValidJSONF b) -> f (Vector b) -> f (ValidJSONF b) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> (a -> f b) -> Vector a -> f (Vector b) forall (t :: * -> *) (f :: * -> *) a b. (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b) traverse a -> f b f Vector a v traverse a -> f b f (ObjectF HashMap Text a hm) = HashMap Text b -> ValidJSONF b forall a. HashMap Text a -> ValidJSONF a ObjectF (HashMap Text b -> ValidJSONF b) -> f (HashMap Text b) -> f (ValidJSONF b) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> (a -> f b) -> HashMap Text a -> f (HashMap Text b) forall (t :: * -> *) (f :: * -> *) a b. (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b) traverse a -> f b f HashMap Text a hm instance (NFData a) => NFData (ValidJSONF a) where {-# INLINE rnf #-} rnf :: ValidJSONF a -> () rnf (AnythingF Value v) = Value -> () forall a. NFData a => a -> () rnf Value v rnf ValidJSONF a NullF = () rnf (BooleanF Bool b) = Bool -> () forall a. NFData a => a -> () rnf Bool b rnf (NumberF Scientific n) = Scientific -> () forall a. NFData a => a -> () rnf Scientific n rnf (StringF Text s) = Text -> () forall a. NFData a => a -> () rnf Text s rnf (ArrayF Vector a v) = Vector a -> () forall a. NFData a => a -> () rnf Vector a v rnf (ObjectF HashMap Text a hm) = HashMap Text a -> () forall a. NFData a => a -> () rnf HashMap Text a hm instance Eq1 ValidJSONF where {-# INLINE liftEq #-} liftEq :: (a -> b -> Bool) -> ValidJSONF a -> ValidJSONF b -> Bool liftEq a -> b -> Bool _ (AnythingF Value v) (AnythingF Value v') = Value v Value -> Value -> Bool forall a. Eq a => a -> a -> Bool == Value v' liftEq a -> b -> Bool _ ValidJSONF a NullF ValidJSONF b NullF = Bool True liftEq a -> b -> Bool _ (BooleanF Bool b) (BooleanF Bool b') = Bool b Bool -> Bool -> Bool forall a. Eq a => a -> a -> Bool == Bool b' liftEq a -> b -> Bool _ (NumberF Scientific n) (NumberF Scientific n') = Scientific n Scientific -> Scientific -> Bool forall a. Eq a => a -> a -> Bool == Scientific n' liftEq a -> b -> Bool _ (StringF Text s) (StringF Text s') = Text s Text -> Text -> Bool forall a. Eq a => a -> a -> Bool == Text s' liftEq a -> b -> Bool f (ArrayF Vector a v) (ArrayF Vector b v') = (a -> b -> Bool) -> Vector a -> Vector b -> Bool forall (f :: * -> *) a b. Eq1 f => (a -> b -> Bool) -> f a -> f b -> Bool liftEq a -> b -> Bool f Vector a v Vector b v' liftEq a -> b -> Bool f (ObjectF HashMap Text a hm) (ObjectF HashMap Text b hm') = (a -> b -> Bool) -> HashMap Text a -> HashMap Text b -> Bool forall (f :: * -> *) a b. Eq1 f => (a -> b -> Bool) -> f a -> f b -> Bool liftEq a -> b -> Bool f HashMap Text a hm HashMap Text b hm' liftEq a -> b -> Bool _ ValidJSONF a _ ValidJSONF b _ = Bool False instance Show1 ValidJSONF where liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ValidJSONF a -> ShowS liftShowsPrec Int -> a -> ShowS _ [a] -> ShowS _ Int prec (AnythingF Value v) = Int -> Value -> ShowS forall a. Show a => Int -> a -> ShowS showsPrec Int prec Value v liftShowsPrec Int -> a -> ShowS _ [a] -> ShowS _ Int prec ValidJSONF a NullF = Int -> Value -> ShowS forall a. Show a => Int -> a -> ShowS showsPrec Int prec Value Null liftShowsPrec Int -> a -> ShowS _ [a] -> ShowS _ Int prec (BooleanF Bool b) = Int -> Bool -> ShowS forall a. Show a => Int -> a -> ShowS showsPrec Int prec Bool b liftShowsPrec Int -> a -> ShowS _ [a] -> ShowS _ Int prec (NumberF Scientific n) = Int -> Scientific -> ShowS forall a. Show a => Int -> a -> ShowS showsPrec Int prec Scientific n liftShowsPrec Int -> a -> ShowS _ [a] -> ShowS _ Int prec (StringF Text s) = Int -> Text -> ShowS forall a. Show a => Int -> a -> ShowS showsPrec Int prec Text s liftShowsPrec Int -> a -> ShowS f [a] -> ShowS g Int prec (ArrayF Vector a v) = (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Vector a -> ShowS forall (f :: * -> *) a. Show1 f => (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS liftShowsPrec Int -> a -> ShowS f [a] -> ShowS g Int prec Vector a v liftShowsPrec Int -> a -> ShowS f [a] -> ShowS g Int prec (ObjectF HashMap Text a hm) = (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> HashMap Text a -> ShowS forall (f :: * -> *) a. Show1 f => (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS liftShowsPrec Int -> a -> ShowS f [a] -> ShowS g Int prec HashMap Text a hm instance (Hashable a) => Hashable (ValidJSONF a) where {-# INLINE hashWithSalt #-} hashWithSalt :: Int -> ValidJSONF a -> Int hashWithSalt Int salt (AnythingF Value v) = Int -> Value -> Int forall a. Hashable a => Int -> a -> Int hashWithSalt Int salt Value v hashWithSalt Int salt ValidJSONF a NullF = Int -> Value -> Int forall a. Hashable a => Int -> a -> Int hashWithSalt Int salt Value Null hashWithSalt Int salt (BooleanF Bool b) = Int -> Bool -> Int forall a. Hashable a => Int -> a -> Int hashWithSalt Int salt Bool b hashWithSalt Int salt (NumberF Scientific n) = Int -> Scientific -> Int forall a. Hashable a => Int -> a -> Int hashWithSalt Int salt Scientific n hashWithSalt Int salt (StringF Text s) = Int -> Text -> Int forall a. Hashable a => Int -> a -> Int hashWithSalt Int salt Text s hashWithSalt Int salt (ArrayF Vector a v) = Int -> Vector a -> Int forall a. Hashable a => Int -> a -> Int hashWithSalt Int salt Vector a v hashWithSalt Int salt (ObjectF HashMap Text a hm) = Int -> HashMap Text a -> Int forall a. Hashable a => Int -> a -> Int hashWithSalt Int salt HashMap Text a hm