packages feed

Cabal-2.0.1.1: doc/API/Cabal/Distribution-Utils-Progress.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Distribution.Utils.Progress</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">Cabal-2.0.1.1: A framework for packaging Haskell software</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Distribution.Utils.Progress</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>A progress monad, which we use to report failure and logging from
 otherwise pure code.</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:Progress">Progress</a> step fail done</li><li class="src short"><a href="#v:stepProgress">stepProgress</a> :: step -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail ()</li><li class="src short"><a href="#v:failProgress">failProgress</a> :: fail -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail done</li><li class="src short"><a href="#v:foldProgress">foldProgress</a> :: (step -&gt; a -&gt; a) -&gt; (fail -&gt; a) -&gt; (done -&gt; a) -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail done -&gt; a</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Progress" class="def">Progress</a> step fail done <a href="#t:Progress" class="selflink">#</a></p><div class="doc"><p>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.</p><p>TODO: Apply Codensity to avoid left-associativity problem.
 See <a href="http://comonad.com/reader/2011/free-monads-for-less/">http://comonad.com/reader/2011/free-monads-for-less/</a> and
 <a href="http://blog.ezyang.com/2012/01/problem-set-the-codensity-transformation/">http://blog.ezyang.com/2012/01/problem-set-the-codensity-transformation/</a></p></div><div class="subs instances"><p id="control.i:Progress" class="caption collapser" onclick="toggleSection('i:Progress')">Instances</p><div id="section.i:Progress" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Progress:Monad:1" class="instance expander" onclick="toggleSection('i:id:Progress:Monad:1')"></span> <a href="file:///opt/ghc/8.2.2/share/doc/ghc-8.2.2/html/libraries/base-4.10.1.0/Control-Monad.html#t:Monad">Monad</a> (<a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail)</span> <a href="#t:Progress" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:Progress:Monad:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-62--62--61-">(&gt;&gt;=)</a> :: <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a -&gt; (a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail b) -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail b <a href="#v:-62--62--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62--62-">(&gt;&gt;)</a> :: <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail b -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail b <a href="#v:-62--62-" class="selflink">#</a></p><p class="src"><a href="#v:return">return</a> :: a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a <a href="#v:return" class="selflink">#</a></p><p class="src"><a href="#v:fail">fail</a> :: <a href="file:///opt/ghc/8.2.2/share/doc/ghc-8.2.2/html/libraries/base-4.10.1.0/Data-String.html#t:String">String</a> -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a <a href="#v:fail" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Progress:Functor:2" class="instance expander" onclick="toggleSection('i:id:Progress:Functor:2')"></span> <a href="file:///opt/ghc/8.2.2/share/doc/ghc-8.2.2/html/libraries/base-4.10.1.0/Data-Functor.html#t:Functor">Functor</a> (<a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail)</span> <a href="#t:Progress" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:Progress:Functor:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fmap">fmap</a> :: (a -&gt; b) -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail b <a href="#v:fmap" class="selflink">#</a></p><p class="src"><a href="#v:-60--36-">(&lt;$)</a> :: a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail b -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a <a href="#v:-60--36-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Progress:Applicative:3" class="instance expander" onclick="toggleSection('i:id:Progress:Applicative:3')"></span> <a href="file:///opt/ghc/8.2.2/share/doc/ghc-8.2.2/html/libraries/base-4.10.1.0/Control-Applicative.html#t:Applicative">Applicative</a> (<a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail)</span> <a href="#t:Progress" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:Progress:Applicative:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:pure">pure</a> :: a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a <a href="#v:pure" class="selflink">#</a></p><p class="src"><a href="#v:-60--42--62-">(&lt;*&gt;)</a> :: <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail (a -&gt; b) -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail b <a href="#v:-60--42--62-" class="selflink">#</a></p><p class="src"><a href="#v:liftA2">liftA2</a> :: (a -&gt; b -&gt; c) -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail b -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail c <a href="#v:liftA2" class="selflink">#</a></p><p class="src"><a href="#v:-42--62-">(*&gt;)</a> :: <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail b -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail b <a href="#v:-42--62-" class="selflink">#</a></p><p class="src"><a href="#v:-60--42-">(&lt;*)</a> :: <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail b -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a <a href="#v:-60--42-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Progress:Alternative:4" class="instance expander" onclick="toggleSection('i:id:Progress:Alternative:4')"></span> <a href="Distribution-Compat-Semigroup.html#t:Monoid">Monoid</a> fail =&gt; <a href="Distribution-Compat-Prelude-Internal.html#t:Alternative">Alternative</a> (<a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail)</span> <a href="#t:Progress" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:Progress:Alternative:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:empty">empty</a> :: <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a <a href="#v:empty" class="selflink">#</a></p><p class="src"><a href="#v:-60--124--62-">(&lt;|&gt;)</a> :: <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a <a href="#v:-60--124--62-" class="selflink">#</a></p><p class="src"><a href="#v:some">some</a> :: <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail [a] <a href="#v:some" class="selflink">#</a></p><p class="src"><a href="#v:many">many</a> :: <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail a -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail [a] <a href="#v:many" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:stepProgress" class="def">stepProgress</a> :: step -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail () <a href="#v:stepProgress" class="selflink">#</a></p><div class="doc"><p>Emit a step and then continue.</p></div></div><div class="top"><p class="src"><a id="v:failProgress" class="def">failProgress</a> :: fail -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail done <a href="#v:failProgress" class="selflink">#</a></p><div class="doc"><p>Fail the computation.</p></div></div><div class="top"><p class="src"><a id="v:foldProgress" class="def">foldProgress</a> :: (step -&gt; a -&gt; a) -&gt; (fail -&gt; a) -&gt; (done -&gt; a) -&gt; <a href="Distribution-Utils-Progress.html#t:Progress">Progress</a> step fail done -&gt; a <a href="#v:foldProgress" class="selflink">#</a></p><div class="doc"><p>Consume a <code><a href="Distribution-Utils-Progress.html#t:Progress">Progress</a></code> calculation. Much like <code><a href="Distribution-Compat-Prelude-Internal.html#v:foldr">foldr</a></code> for lists but with two
 base cases, one for a final result and one for failure.</p><p>Eg to convert into a simple <code><a href="file:///opt/ghc/8.2.2/share/doc/ghc-8.2.2/html/libraries/base-4.10.1.0/Data-Either.html#t:Either">Either</a></code> result use:</p><pre>foldProgress (flip const) Left Right</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.18.1</p></div></body></html>