Module

Polyform.Input.Foreign

Package
purescript-polyform
Repository
paluh/purescript-polyform

#FieldErr Source

type FieldErr = Variant (value :: MultipleErrors)

WARNING! It is still prototyping phase of this module.

#Field Source

type Field attrs err value = { value :: V err value | attrs }

#IntField Source

type IntField attrs = Field attrs FieldErr Int

#StringField Source

type StringField attrs = Field attrs FieldErr String

#NumberField Source

type NumberField attrs = Field attrs FieldErr Number

#ArrayField Source

type ArrayField attrs e val = Field attrs (Array e) (Array val)

Val is a self reference to an object

#Attrs Source

type Attrs val = Array (Attr val)

You should wrap this array into your constructors which represent some type of object.

#AttrErr Source

data AttrErr field

Attr wraps other field and attaches attribute name to it

Constructors

#Attr Source

data Attr field

Constructors

#attr Source

attr :: forall v m field e. Monad m => (e -> field) -> String -> Validation m e Foreign v -> Validation m (Array (Attr field)) Foreign v

You should define your fields using something like:

data MyField = IntField (IntField ()) | StringField (StringField ()) | NumberField (NumberField ()) | Object (Attrs MyField)

What is really imporant is that Attrs wrapper should be recursive.

#object Source

object :: forall v m field. Monad m => (Array (Attr field) -> field) -> Validation m (Array (Attr field)) Foreign v -> Validation m field Foreign v

#arrayFieldsValidation Source

arrayFieldsValidation :: forall v m e. Monad m => Validation m e Foreign v -> Validation m (Array e) (Array Foreign) (Array v)

#arrayValidation Source

arrayValidation :: forall t236 t198 t194 t191. Monad t198 => Validation t198 t194 Foreign t191 -> Validation t198 (Array (Variant (array :: MultipleErrors, values :: Array t194 | t236))) Foreign (Array t191)

#intValidation Source

intValidation :: forall err m. Monad m => Validation m (Array (Variant (value :: MultipleErrors | err))) Foreign Int

#stringValidation Source

stringValidation :: forall err m. Monad m => Validation m (Array (Variant (value :: MultipleErrors | err))) Foreign String