cabal-install-solver
Safe HaskellSafe-Inferred
LanguageHaskell2010

Distribution.Solver.Types.Progress

Synopsis

Documentation

data Progress step fail done Source #

A type to represent the unfolding of an expensive long running calculation that may fail. We may get intermediate steps before the final result which may be used to indicate progress and/or logging messages.

Constructors

Step step (Progress step fail done) 
Fail fail 
Done done 

Instances

Instances details
Monoid fail => Alternative (Progress step fail) Source # 
Instance details

Defined in Distribution.Solver.Types.Progress

Methods

empty :: Progress step fail a #

(<|>) :: Progress step fail a -> Progress step fail a -> Progress step fail a #

some :: Progress step fail a -> Progress step fail [a] #

many :: Progress step fail a -> Progress step fail [a] #

Applicative (Progress step fail) Source # 
Instance details

Defined in Distribution.Solver.Types.Progress

Methods

pure :: a -> Progress step fail a #

(<*>) :: Progress step fail (a -> b) -> Progress step fail a -> Progress step fail b #

liftA2 :: (a -> b -> c) -> Progress step fail a -> Progress step fail b -> Progress step fail c #

(*>) :: Progress step fail a -> Progress step fail b -> Progress step fail b #

(<*) :: Progress step fail a -> Progress step fail b -> Progress step fail a #

Functor (Progress step fail) Source # 
Instance details

Defined in Distribution.Solver.Types.Progress

Methods

fmap :: (a -> b) -> Progress step fail a -> Progress step fail b #

(<$) :: a -> Progress step fail b -> Progress step fail a #

Monad (Progress step fail) Source # 
Instance details

Defined in Distribution.Solver.Types.Progress

Methods

(>>=) :: Progress step fail a -> (a -> Progress step fail b) -> Progress step fail b #

(>>) :: Progress step fail a -> Progress step fail b -> Progress step fail b #

return :: a -> Progress step fail a #

foldProgress :: (step -> a -> a) -> (fail -> a) -> (done -> a) -> Progress step fail done -> a Source #

Consume a Progress calculation. Much like foldr for lists but with two base cases, one for a final result and one for failure.

Eg to convert into a simple Either result use:

foldProgress (flip const) Left Right