HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

ModuleCabal-3.12.1.0Haskell2010

Distribution.Utils.Progress

A progress monad, which we use to report failure and logging from otherwise pure code.

  • 1 type
  • 3 values
  • PackageCabal-3.12.1.0
  • Exports4
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceProgress.hs
datadata Progress step fail done
#

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

TODO: Apply Codensity to avoid left-associativity problem. See http://comonad.com/reader/2011/free-monads-for-less/ and http://blog.ezyang.com/2012/01/problem-set-the-codensity-transformation/

Instances4Monad, Functor, Applicative, Alternative
valuefoldProgress
  1. :: step -> a -> a
  2. -> fail -> a
  3. -> done -> a
  4. -> Progress step fail done
  5. -> 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