Safe Haskell | None |
---|---|
Language | Haskell2010 |
Union types describing JSON objects, and operations for querying these types.
Synopsis
- typeSize :: Type -> Int
- newtype Dict = Dict {}
- keys :: Dict -> Set Text
- get :: Text -> Dict -> Type
- withDict :: (Map Text Type -> Map Text Type) -> Dict -> Dict
- data Type
- emptyType :: Type
- isSimple :: Type -> Bool
- isArray :: Type -> Bool
- isObject :: Type -> Bool
- typeAsSet :: Type -> Set Type
- hasNonTopTObj :: Type -> Bool
- hasTObj :: Type -> Bool
- isNullable :: Type -> Bool
- emptySetLikes :: Set Type
Documentation
Dictionary of types indexed by names.
Instances
Eq Dict Source # | |
Data Dict Source # | |
Defined in Data.Aeson.AutoType.Type gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Dict -> c Dict # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Dict # dataTypeOf :: Dict -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Dict) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Dict) # gmapT :: (forall b. Data b => b -> b) -> Dict -> Dict # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Dict -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Dict -> r # gmapQ :: (forall d. Data d => d -> u) -> Dict -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Dict -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Dict -> m Dict # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Dict -> m Dict # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Dict -> m Dict # | |
Ord Dict Source # | |
Show Dict Source # | |
Generic Dict Source # | |
Out Dict Source # | |
type Rep Dict Source # | |
Defined in Data.Aeson.AutoType.Type |
withDict :: (Map Text Type -> Map Text Type) -> Dict -> Dict Source #
Make operation on a map to an operation on a Dict.
Union types for JSON values.
Instances
Eq Type Source # | |
Data Type Source # | |
Defined in Data.Aeson.AutoType.Type gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Type -> c Type # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Type # dataTypeOf :: Type -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Type) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type) # gmapT :: (forall b. Data b => b -> b) -> Type -> Type # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r # gmapQ :: (forall d. Data d => d -> u) -> Type -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Type -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Type -> m Type # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type # | |
Ord Type Source # | |
Show Type Source # | |
Generic Type Source # | |
Out Type Source # | |
Uniplate Type Source # | |
Defined in Data.Aeson.AutoType.Type | |
type Rep Type Source # | |
Defined in Data.Aeson.AutoType.Type type Rep Type = D1 (MetaData "Type" "Data.Aeson.AutoType.Type" "json-autotype-2.0.0-Kl2DwLjduovLZz8VWK3RQR" False) (((C1 (MetaCons "TNull" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "TBool" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "TNum" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "TString" PrefixI False) (U1 :: * -> *))) :+: ((C1 (MetaCons "TUnion" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Set Type))) :+: C1 (MetaCons "TLabel" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text))) :+: (C1 (MetaCons "TObj" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Dict)) :+: C1 (MetaCons "TArray" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type))))) |
isArray :: Type -> Bool Source #
Is the top-level constructor a TArray? | Check if the given type has non-top TObj.
hasNonTopTObj :: Type -> Bool Source #
Check if the given type has non-top TObj.
isNullable :: Type -> Bool Source #
Check if this is nullable (Maybe) type, or not. Nullable type will always accept TNull or missing key that contains it.
emptySetLikes :: Set Type Source #
"Null-ish" types