Module

Data.Validation.Jaws.Product

Package
purescript-jaws
Repository
paluh/purescript-jaws

#Builder Source

newtype Builder m tok a b

This is really general type which is specialized below. I'm thinking of it here as a builder which extracts/validates product elements from given tok, "attaching" them to results from previous validation steps a. It is really close to categorical view of product - if we want to treat input data tok as product we have to be able to provide morphisms which extract elements of this product from it.

Constructors

Instances

#Result Source

data Result i v

This is our helper type which traces both (valid and invalid) values on it's "success branch", so if any further validation failure we can easily build error value.

Constructors

Instances

#valid Source

valid :: forall i v. v -> Result (Either i v) v

#mapI Source

mapI :: forall i i' v. (i -> i') -> Result i v -> Result i' v

#ProductValidation Source

type ProductValidation m tok i i' v v' = Builder m tok (Result i v) (Result i' v')

#tupleValidation Source

tupleValidation :: forall b e i m tok v. Monad m => (tok -> m (Either e b)) -> ProductValidation m tok i (Tuple (Either e b) i) v (Tuple b v)

#pureTupleValidation Source

pureTupleValidation :: forall b e i m tok v. Monad m => (tok -> Either e b) -> ProductValidation m tok i (Tuple (Either e b) i) v (Tuple b v)

#runTupleValidation Source

runTupleValidation :: forall i m tok v. Monad m => ProductValidation m tok Unit i Unit v -> (tok -> m (Either i v))

#recordFieldValidation Source

recordFieldValidation :: forall b e i i' l m tok v v'. IsSymbol l => Monad m => RowCons l (Either e b) i i' => RowCons l b v v' => RowLacks l i => RowLacks l v => Functor m => SProxy l -> (tok -> m (Either e b)) -> ProductValidation m tok (Record i) (Record i') (Record v) (Record v')

#pureRecordFieldValidation Source

pureRecordFieldValidation :: forall b e i i' l m tok v v'. IsSymbol l => Monad m => RowCons l (Either e b) i i' => RowCons l b v v' => RowLacks l i => RowLacks l v => Functor m => SProxy l -> (tok -> Either e b) -> ProductValidation m tok (Record i) (Record i') (Record v) (Record v')

#runRecordValidation Source

runRecordValidation :: forall i m tok v. Monad m => ProductValidation m tok (Record ()) (Record i) (Record ()) (Record v) -> (tok -> m (Either (Record i) (Record v)))