Distribution.Solver.Types.Progress

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 #

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) # |
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) # |
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) # |
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) # |
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 #

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