json-autotype

Safe HaskellNone
LanguageHaskell2010

Data.Aeson.AutoType.Type

Description

Union types describing JSON objects, and operations for querying these types.

Synopsis

Documentation

typeSize :: Type -> Int

Size of the Type term.

newtype Dict

Dictionary of types indexed by names.

Constructors

Dict 

Fields

unDict :: Map Text Type
 

Instances

keys :: Dict -> Set Text

Take all keys from dictionary.

get :: Text -> Dict -> Type

Lookup the Type within the dictionary.

withDict :: (Map Text Type -> Map Text Type) -> Dict -> Dict

Make operation on a map to an operation on a Dict.

data Type

Union types for JSON values.

Constructors

TNull 
TBool 
TNum 
TString 
TUnion (Set Type) 
TLabel Text 
TObj Dict 
TArray Type 

Instances

Eq Type 
Data Type 
Ord Type 
Show Type 
Generic Type 
Out Type 
Uniplate Type 
type Rep Type 

emptyType :: Type

Empty type

isSimple :: Type -> Bool

Is it a simple (non-compound) Type?

isArray :: Type -> Bool

Is the top-level constructor a TArray? | Check if the given type has non-top TObj.

isObject :: Type -> Bool

Is the top-level constructor a TObj?

typeAsSet :: Type -> Set Type

Convert any type into union type (even if just singleton).

hasNonTopTObj :: Type -> Bool

Check if the given type has non-top TObj.

hasTObj :: Type -> Bool

Check if the given type has TObj on top or within array..

isNullable :: Type -> Bool

Check if this is nullable (Maybe) type, or not. Nullable type will always accept TNull or missing key that contains it.