Module

Polyform.Validator

Package
purescript-polyform
Repository
paluh/purescript-polyform

#Validator Source

newtype Validator m e i o

Constructors

Instances

#ask Source

ask :: forall e m i. Monad m => Semigroup e => Validator m e i i

#runValidator Source

runValidator :: forall e o m i. Validator m e i o -> (i -> m (V e o))

#hoistFn Source

hoistFn :: forall o m i e. Applicative m => Semigroup e => (i -> o) -> Validator m e i o

These hoists set is used to lift functions into Validator

#hoistFnV Source

hoistFnV :: forall o m i e. Applicative m => Semigroup e => (i -> V e o) -> Validator m e i o

#hoistFnM Source

hoistFnM :: forall o m i e. Applicative m => Semigroup e => (i -> m o) -> Validator m e i o

#hoistFnMV Source

hoistFnMV :: forall o m i e. (i -> m (V e o)) -> Validator m e i o

#hoistFnEither Source

hoistFnEither :: forall o m i e. Applicative m => Semigroup e => (i -> Either e o) -> Validator m e i o

#hoist Source

hoist :: forall o m n i e. Functor m => (m ~> n) -> Validator m e i o -> Validator n e i o

#lift Source

lift :: forall t m o i e. MonadTrans t => Monad m => Validator m e i o -> Validator (t m) e i o

#BifunctorValidator Source

newtype BifunctorValidator m i e o

Provides access to validation result so you can bimap over e and b type in resulting V e b.

Constructors

Instances

#bimapValidator Source

bimapValidator :: forall o' o m e' e i. Monad m => (e -> e') -> (o -> o') -> Validator m e i o -> Validator m e' i o'

#lmapValidator Source

lmapValidator :: forall o m i e' e. Monad m => (e -> e') -> Validator m e i o -> Validator m e' i o

#rmapValidator Source

rmapValidator :: forall m o' o i e. Monad m => (o -> o') -> Validator m e i o -> Validator m e i o'

#optional Source

optional :: forall m o i e. Monad m => Semigroup e => Validator m e i o -> Validator m e i (Maybe o)

#valid Source

valid :: forall e a. Semigroup e => a -> V e a

#toStarExceptT Source

toStarExceptT :: forall o m i e. Functor m => Validator m e i o -> Star (ExceptT e m) i o

#lmapToStarExceptT Source

lmapToStarExceptT :: forall o m i e' e. Monad m => (e -> e') -> Validator m e i o -> Star (ExceptT e' m) i o

It is often the case that after successfull chain of validation we want to drop to "non semigroup" error representation like Variant etc.

#fromStarExceptT Source

fromStarExceptT :: forall o m i e. Functor m => Star (ExceptT e m) i o -> Validator m e i o