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 #

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) # 
Instance details

Defined in Data.Schema.Internal.Types

Methods

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

fieldName :: FieldDef o s a -> Text #

newtype Field s o a #

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) # 
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) # 
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) # 
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 #

type Fields s o = Field s o o #

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

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

Define a field

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

data AltDef s a #

Metadata for an alternative of type a based on schema s

Constructors

AltDef 

Fields

Instances
HFunctor AltDef # 
Instance details

Defined in Data.Schema.Internal.Types

Methods

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

data SchemaF p s a where #

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) # 
Instance details

Defined in Data.Schema.Internal.Types

Methods

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

newtype Schema p a #

The Schema type itself for a set of primitives p

Constructors

Schema 

Fields

Instances
HFunctor Schema #

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 #

Invariant (Schema p) # 
Instance details

Defined in Data.Schema.Internal.Types

Methods

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

class HasSchema a where #

Associated Types

type PrimitivesOf a :: * -> * #

Methods

getSchema :: Schema (PrimitivesOf a) a #