cabal-install-solver-3.12.1.0: The command-line interface for Cabal and Hackage.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Distribution.Solver.Types.Progress

Synopsis

- data Progress step fail done
  - = Step step (Progress step fail done)
  - | Fail fail
  - | Done done
- foldProgress :: (step -> a -> a) -> (fail -> a) -> (done -> a) -> Progress step fail done -> a

# 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 Source # (<|>) :: Progress step fail a -> Progress step fail a -> Progress step fail a Source # some :: Progress step fail a -> Progress step fail [a] Source # many :: Progress step fail a -> Progress step fail [a] Source #
Applicative (Progress step fail) Source # |

Instance details

Defined in Distribution.Solver.Types.Progress

Methods

pure :: a -> Progress step fail a Source #

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

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

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

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

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 Source # (<$) :: a -> Progress step fail b -> Progress step fail a Source #
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 Source # (>>) :: Progress step fail a -> Progress step fail b -> Progress step fail b Source # return :: a -> Progress step fail a Source #

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