mu-schema-0.1.0.0: Format-independent schemas for serialization

Safe HaskellNone
LanguageHaskell2010

Mu.Schema.Interpretation.Anonymous

Description

This module provides "anonymous terms". These terms can be used when you don't want to write your own Haskell type, but simply have a quick and dirty interpretation for a schema type. An important limitation is that anonymous terms may only contain primitive fields.

The names of the types exposed in this module refer to the amount of fields in the record. Hence, use V0 for empty record, V1 for a record with one field, V2 for two, and so forth.

Synopsis

Documentation

data V0 w sch sty where Source #

Anonymous term for a record with zero fields.

Constructors

V0 :: (sch :/: sty) ~ DRecord nm '[] => V0 w sch sty 
Instances
(sch :/: sty) ~ DRecord nm ([] :: [FieldDefB Type k f]) => FromSchema w (sch :: Schema k f) (sty :: k) (V0 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

fromSchema :: Term w sch (sch :/: sty) -> V0 w sch sty Source #

(sch :/: sty) ~ DRecord nm ([] :: [FieldDefB Type k f]) => ToSchema w (sch :: Schema k f) (sty :: k) (V0 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

toSchema :: V0 w sch sty -> Term w sch (sch :/: sty) Source #

Eq (V0 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

(==) :: V0 w sch sty -> V0 w sch sty -> Bool #

(/=) :: V0 w sch sty -> V0 w sch sty -> Bool #

Ord (V0 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

compare :: V0 w sch sty -> V0 w sch sty -> Ordering #

(<) :: V0 w sch sty -> V0 w sch sty -> Bool #

(<=) :: V0 w sch sty -> V0 w sch sty -> Bool #

(>) :: V0 w sch sty -> V0 w sch sty -> Bool #

(>=) :: V0 w sch sty -> V0 w sch sty -> Bool #

max :: V0 w sch sty -> V0 w sch sty -> V0 w sch sty #

min :: V0 w sch sty -> V0 w sch sty -> V0 w sch sty #

Show (V0 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

showsPrec :: Int -> V0 w sch sty -> ShowS #

show :: V0 w sch sty -> String #

showList :: [V0 w sch sty] -> ShowS #

data V1 w sch sty where Source #

Anonymous term for a record with one field.

Constructors

V1 :: (sch :/: sty) ~ DRecord nm '[FieldDef f (TPrimitive a)] => w a -> V1 w sch sty 
Instances
(Functor w, (sch :/: sty) ~ DRecord nm (FieldDef f2 (TPrimitive a :: FieldTypeB Type k) ': ([] :: [FieldDefB Type k f1]))) => FromSchema w (sch :: Schema k f1) (sty :: k) (V1 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

fromSchema :: Term w sch (sch :/: sty) -> V1 w sch sty Source #

(Functor w, (sch :/: sty) ~ DRecord nm (FieldDef f2 (TPrimitive a :: FieldTypeB Type k) ': ([] :: [FieldDefB Type k f1]))) => ToSchema w (sch :: Schema k f1) (sty :: k) (V1 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

toSchema :: V1 w sch sty -> Term w sch (sch :/: sty) Source #

(Eq (w a), (sch :/: sty) ~ DRecord nm (FieldDef f2 (TPrimitive a :: FieldTypeB Type k) ': ([] :: [FieldDefB Type k f1]))) => Eq (V1 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

(==) :: V1 w sch sty -> V1 w sch sty -> Bool #

(/=) :: V1 w sch sty -> V1 w sch sty -> Bool #

(Ord (w a), (sch :/: sty) ~ DRecord nm (FieldDef f2 (TPrimitive a :: FieldTypeB Type k) ': ([] :: [FieldDefB Type k f1]))) => Ord (V1 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

compare :: V1 w sch sty -> V1 w sch sty -> Ordering #

(<) :: V1 w sch sty -> V1 w sch sty -> Bool #

(<=) :: V1 w sch sty -> V1 w sch sty -> Bool #

(>) :: V1 w sch sty -> V1 w sch sty -> Bool #

(>=) :: V1 w sch sty -> V1 w sch sty -> Bool #

max :: V1 w sch sty -> V1 w sch sty -> V1 w sch sty #

min :: V1 w sch sty -> V1 w sch sty -> V1 w sch sty #

(Show (w a), (sch :/: sty) ~ DRecord nm (FieldDef f2 (TPrimitive a :: FieldTypeB Type k) ': ([] :: [FieldDefB Type k f1]))) => Show (V1 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

showsPrec :: Int -> V1 w sch sty -> ShowS #

show :: V1 w sch sty -> String #

showList :: [V1 w sch sty] -> ShowS #

data V2 w sch sty where Source #

Anonymous term for a record with two fields.

Constructors

V2 :: (sch :/: sty) ~ DRecord nm '[FieldDef f (TPrimitive a), FieldDef g (TPrimitive b)] => w a -> w b -> V2 w sch sty 
Instances
(Functor w, (sch :/: sty) ~ DRecord nm (FieldDef f2 (TPrimitive a :: FieldTypeB Type k) ': (FieldDef g (TPrimitive b :: FieldTypeB Type k) ': ([] :: [FieldDefB Type k f1])))) => FromSchema w (sch :: Schema k f1) (sty :: k) (V2 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

fromSchema :: Term w sch (sch :/: sty) -> V2 w sch sty Source #

(Functor w, (sch :/: sty) ~ DRecord nm (FieldDef f2 (TPrimitive a :: FieldTypeB Type k) ': (FieldDef g (TPrimitive b :: FieldTypeB Type k) ': ([] :: [FieldDefB Type k f1])))) => ToSchema w (sch :: Schema k f1) (sty :: k) (V2 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

toSchema :: V2 w sch sty -> Term w sch (sch :/: sty) Source #

(Eq (w a), Eq (w b), (sch :/: sty) ~ DRecord nm (FieldDef f2 (TPrimitive a :: FieldTypeB Type k) ': (FieldDef g (TPrimitive b :: FieldTypeB Type k) ': ([] :: [FieldDefB Type k f1])))) => Eq (V2 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

(==) :: V2 w sch sty -> V2 w sch sty -> Bool #

(/=) :: V2 w sch sty -> V2 w sch sty -> Bool #

(Ord (w a), Ord (w b), (sch :/: sty) ~ DRecord nm (FieldDef f2 (TPrimitive a :: FieldTypeB Type k) ': (FieldDef g (TPrimitive b :: FieldTypeB Type k) ': ([] :: [FieldDefB Type k f1])))) => Ord (V2 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

compare :: V2 w sch sty -> V2 w sch sty -> Ordering #

(<) :: V2 w sch sty -> V2 w sch sty -> Bool #

(<=) :: V2 w sch sty -> V2 w sch sty -> Bool #

(>) :: V2 w sch sty -> V2 w sch sty -> Bool #

(>=) :: V2 w sch sty -> V2 w sch sty -> Bool #

max :: V2 w sch sty -> V2 w sch sty -> V2 w sch sty #

min :: V2 w sch sty -> V2 w sch sty -> V2 w sch sty #

(Show (w a), Show (w b), (sch :/: sty) ~ DRecord nm (FieldDef f2 (TPrimitive a :: FieldTypeB Type k) ': (FieldDef g (TPrimitive b :: FieldTypeB Type k) ': ([] :: [FieldDefB Type k f1])))) => Show (V2 w sch sty) Source # 
Instance details

Defined in Mu.Schema.Interpretation.Anonymous

Methods

showsPrec :: Int -> V2 w sch sty -> ShowS #

show :: V2 w sch sty -> String #

showList :: [V2 w sch sty] -> ShowS #