hpython-0.2: Python language tools

Copyright(C) CSIRO 2017-2019
LicenseBSD3
MaintainerIsaac Elliott <isaace71295@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Validate.Monadic

Description

 
Synopsis

Documentation

newtype ValidateM e m a Source #

The composition of Validation with another Applicative functor.

Validation is not a Monad, and ValidateM is not a monad transformer. It is equipped with a useful bind function, but that function does not have the right type to make ValidateM a Monad (besides which it would break the laws)

Constructors

ValidateM 

Fields

Instances
Functor m => Functor (ValidateM e m) Source # 
Instance details

Defined in Data.Validate.Monadic

Methods

fmap :: (a -> b) -> ValidateM e m a -> ValidateM e m b #

(<$) :: a -> ValidateM e m b -> ValidateM e m a #

(Applicative m, Semigroup e) => Applicative (ValidateM e m) Source # 
Instance details

Defined in Data.Validate.Monadic

Methods

pure :: a -> ValidateM e m a #

(<*>) :: ValidateM e m (a -> b) -> ValidateM e m a -> ValidateM e m b #

liftA2 :: (a -> b -> c) -> ValidateM e m a -> ValidateM e m b -> ValidateM e m c #

(*>) :: ValidateM e m a -> ValidateM e m b -> ValidateM e m b #

(<*) :: ValidateM e m a -> ValidateM e m b -> ValidateM e m a #

runValidateM :: ValidateM e m a -> m (Validation e a) Source #

Unwrap a ValidateM

bindVM :: Monad m => m a -> (a -> ValidateM e m b) -> ValidateM e m b Source #

Bind into a ValidateM. Note that the first parameter is m a, not ValidateM e m a.

liftVM0 :: (Functor m, Semigroup e) => m a -> ValidateM e m a Source #

Lift into a succeeding validation

liftVM1 :: (forall x. m x -> m x) -> ValidateM e m a -> ValidateM e m a Source #

Run a natural transformation across ValidateM to alter m

errorVM :: Applicative m => e -> ValidateM e m a Source #

Lift an error into ValidateM

errorVM1 :: (Applicative f, Applicative m) => e -> ValidateM (f e) m a Source #

Lift an error in an Applicative into ValidateM. This is especially useful if you're using list or NonEmpty to collect errors.