hschema-0.0.1.1: Describe schemas for your Haskell data types.

Safe HaskellNone
LanguageHaskell2010

Data.Schema.Internal.Types

Synopsis

Documentation

data FieldDef o s a where Source #

Metadata for a field of type a, belonging to the data type o and based on schema s

Constructors

RequiredField :: Text -> s a -> Getter o a -> FieldDef o s a 
OptionalField :: Text -> s a -> Getter o (Maybe a) -> FieldDef o s (Maybe a) 
Instances
HFunctor (FieldDef o) Source # 
Instance details

Defined in Data.Schema.Internal.Types

Methods

hfmap :: (m ~> n) -> FieldDef o m ~> FieldDef o n Source #

newtype Field s o a Source #

The type of a field of type a, belonging to the data type o and based on schema s

Constructors

Field 

Fields

Instances
Profunctor (Field s) Source # 
Instance details

Defined in Data.Schema.Internal.Types

Methods

dimap :: (a -> b) -> (c -> d) -> Field s b c -> Field s a d #

lmap :: (a -> b) -> Field s b c -> Field s a c #

rmap :: (b -> c) -> Field s a b -> Field s a c #

(#.) :: Coercible c b => q b c -> Field s a b -> Field s a c #

(.#) :: Coercible b a => Field s b c -> q a b -> Field s a c #

Functor (Field s o) Source # 
Instance details

Defined in Data.Schema.Internal.Types

Methods

fmap :: (a -> b) -> Field s o a -> Field s o b #

(<$) :: a -> Field s o b -> Field s o a #

Applicative (Field s o) Source # 
Instance details

Defined in Data.Schema.Internal.Types

Methods

pure :: a -> Field s o a #

(<*>) :: Field s o (a -> b) -> Field s o a -> Field s o b #

liftA2 :: (a -> b -> c) -> Field s o a -> Field s o b -> Field s o c #

(*>) :: Field s o a -> Field s o b -> Field s o b #

(<*) :: Field s o a -> Field s o b -> Field s o a #

hoistField :: (m ~> n) -> Field m o a -> Field n o a Source #

type Fields s o = Field s o o Source #

The set of fields for the data type o based on schema s

field :: Text -> s a -> Getter o a -> Field s o a Source #

Define a field

optional :: Text -> s a -> Getter o (Maybe a) -> Field s o (Maybe a) Source #

data AltDef s a Source #

Metadata for an alternative of type a based on schema s

Constructors

AltDef 

Fields

Instances
HFunctor AltDef Source # 
Instance details

Defined in Data.Schema.Internal.Types

Methods

hfmap :: (m ~> n) -> AltDef m ~> AltDef n Source #

data SchemaF p s a where Source #

Metadata for a schema s based on primitives p and representing type a

Constructors

PrimitiveSchema :: p a -> SchemaF p s a 
RecordSchema :: Fields s a -> SchemaF p s a 
UnionSchema :: NonEmpty (AltDef s a) -> SchemaF p s a 
AliasSchema :: s a -> Iso' a b -> SchemaF p s b 
Instances
HFunctor (SchemaF p) Source # 
Instance details

Defined in Data.Schema.Internal.Types

Methods

hfmap :: (m ~> n) -> SchemaF p m ~> SchemaF p n Source #

newtype Schema p a Source #

The Schema type itself for a set of primitives p

Constructors

Schema 

Fields

Instances
HFunctor Schema Source #

An Schema has a HFunctor that performs a natural transformation of the primitive algebra of the Schema

Instance details

Defined in Data.Schema.Internal.Types

Methods

hfmap :: (m ~> n) -> Schema m ~> Schema n Source #

Invariant (Schema p) Source # 
Instance details

Defined in Data.Schema.Internal.Types

Methods

invmap :: (a -> b) -> (b -> a) -> Schema p a -> Schema p b #

class HasSchema a where Source #

Associated Types

type PrimitivesOf a :: * -> * Source #