Commits

Austin Seipp committed c4b1311

Update documentation.

Signed-off-by: Austin Seipp <mad.one@gmail.com>

Comments (0)

Files changed (9)

doc/Control-Delimited-Tutorial.html

 window.onload = function () {pageLoad();setSynopsis("mini_Control-Delimited-Tutorial.html");};
 //]]>
 </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Control-Delimited-Tutorial.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">asai-0.0.0.0: A minimal library for delimited continuations.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>portable</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>mad.one@gmail.com</td></tr><tr><th>Safe Haskell</th><td>Safe-Inferred</td></tr></table><p class="caption">Control.Delimited.Tutorial</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Introduction
-</a></li><li><a href="#g:2">Notes on <code>do</code>-notation
-</a></li><li><a href="#g:3">References
+</a></li><li><a href="#g:2">Using <code>do</code>-notation
+</a></li><li><a href="#g:3">Other notes
+</a></li><li><a href="#g:4">References
 </a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This module provides a brief introductory tutorial in the
  &quot;Introduction&quot; section, followed by some discussion behind the
  theory of the library with references.
 </h1><div class="doc"><p>Lorem ipsum...
 </p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>runDelim $ reset $ (shift1 (\_ -&gt; return &quot;hello&quot;) &gt;&gt;= \r -&gt; return (r + 1))
 </code></strong>&quot;hello&quot;
-</pre></div><h1 id="g:2">Notes on <code>do</code>-notation
-</h1><div class="doc"><p>Lorem ipsum...
-</p></div><h1 id="g:3">References
+</pre></div><h1 id="g:2">Using <code>do</code>-notation
+</h1><div class="doc"><p>It's possible to use GHC's <code>RebindableSyntax</code> extension to re-define
+<code>do</code> notation to use the <code><a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a></code> type class.
+</p><p>Begin your module by hiding the regular <code><a href="/usr/local/share/doc/ghc/html/libraries/base-4.6.0.0/Control-Monad.html#t:Monad">Monad</a></code> methods, and then
+redefine <code><a href="/usr/local/share/doc/ghc/html/libraries/base-4.6.0.0/Prelude.html#t:-62--62--61-">&gt;&gt;=</a></code> and <code><a href="/usr/local/share/doc/ghc/html/libraries/base-4.6.0.0/Prelude.html#t:return">return</a></code>. Feel free to redefine
+other operators too. Here's an example (you'll need to fix the
+<code>LANGUAGE</code> pragma yourself on the first line, since Haddock eats it
+otherwise):
+</p><pre> [-# LANGUAGE RebindableSyntax #-]
+ module Foo where
+ import Prelude hiding (return, fail, (&gt;&gt;=), (=&lt;&lt;), (&gt;&gt;))
+ import Control.Delimited
+
+ -- Aspects of RebindableSyntax
+ return x = ret x
+ fail s   = error s
+ m &gt;&gt;= f  = m !&gt;&gt;= f
+ f =&lt;&lt; m  = m !&gt;&gt;= f
+ f &gt;&gt; k   = m !&gt;&gt;= \_ -&gt; k
+
+ -- Now use 'do' notation instead of the indexed bind/return
+ -- functions.
+
+ -- You can lift regular monads into parameterized monads using
+ -- 'lift' and 'runI'
+ io1 :: IO ()
+ io1 = runI $ do
+   lift $ putStrLn &quot;hi!&quot;
+   lift $ putStrLn &quot;hi!&quot;
+   return ()
+
+ test1 :: String
+ test1 = runDelim $ reset $ do
+   r &lt;- shift1 (\_ -&gt; return &quot;hello&quot;)
+   return (r + 1)
+ -- This is equivalent to the OchaCaml term:
+ --   reset (fun () -&gt; 1 + shift (fun _ -&gt; &quot;hello&quot;)) ;;
+</pre><p>See <code>examples/Simple.hs</code> (included in the distribution) for several
+more examples.
+</p></div><h1 id="g:3">Other notes
+</h1><div class="doc"><p>This package requires GHC's <code>RankNTypes</code> extension, as it uses it for
+the definition of <code><a href="Control-Delimited.html#v:shift2">shift2</a></code>. The original
+implementation by Kiselyov is Haskell98. You do not need to enable
+<code>RankNTypes</code> to use this package.
+</p></div><h1 id="g:4">References
 </h1><div class="doc"><ul><li> <em>Polymorphic Delimited Continuations</em>, by Asai, Kameyama in <em>APLAS '07</em>:
     <a href="http://logic.cs.tsukuba.ac.jp/~kam/paper/aplas07.pdf">http://logic.cs.tsukuba.ac.jp/~kam/paper/aplas07.pdf</a>
 </li><li> <em>Genuine shift\reset in Haskell98</em>, by Kiselyov, on <em>haskell-cafe</em>:

doc/Control-Indexed-Monad.html

 </a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Parameterized monads.
 </p><p>When using GHC with <code>RebindableSyntax</code>, it's possible to overload
  regular <code>do</code>-notation to use the <code><a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a></code> typeclass.
-</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">class</span>  <a href="#t:Monad-39-">Monad'</a> m  <span class="keyword">where</span><ul class="subs"><li><a href="#v:ret">ret</a> ::  t -&gt; m a a t</li><li><a href="#v:bind">bind</a> ::  m b g s -&gt; (s -&gt; m a b t) -&gt; m a g t</li></ul></li><li class="src short"><a href="#v:-33--62--62--61-">(!&gt;&gt;=)</a> :: <a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a> m =&gt; m b g s -&gt; (s -&gt; m a b t) -&gt; m a g t</li><li class="src short"><a href="#v:-33--43--62--62-">(!+&gt;&gt;)</a> :: <a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a> m =&gt; m b g s -&gt; m a b t -&gt; m a g t</li></ul></div><div id="interface"><h1 id="g:1">Parameterized monads
+</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">class</span>  <a href="#t:Monad-39-">Monad'</a> m  <span class="keyword">where</span><ul class="subs"><li><a href="#v:ret">ret</a> ::  t -&gt; m a a t</li><li><a href="#v:bind">bind</a> ::  m b g s -&gt; (s -&gt; m a b t) -&gt; m a g t</li></ul></li><li class="src short"><span class="keyword">data</span>  <a href="#t:MW">MW</a> m p q a</li><li class="src short"><a href="#v:lift">lift</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.6.0.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; m a -&gt; <a href="Control-Indexed-Monad.html#t:MW">MW</a> m p q a</li><li class="src short"><a href="#v:runI">runI</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.6.0.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a href="Control-Indexed-Monad.html#t:MW">MW</a> m p q a -&gt; m a</li><li class="src short"><a href="#v:-33--62--62--61-">(!&gt;&gt;=)</a> :: <a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a> m =&gt; m b g s -&gt; (s -&gt; m a b t) -&gt; m a g t</li><li class="src short"><a href="#v:-33--43--62--62-">(!+&gt;&gt;)</a> :: <a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a> m =&gt; m b g s -&gt; m a b t -&gt; m a g t</li></ul></div><div id="interface"><h1 id="g:1">Parameterized monads
 </h1><div class="top"><p class="src"><span class="keyword">class</span>  <a name="t:Monad-39-" class="def">Monad'</a> m  <span class="keyword">where</span><a href="src/Control-Indexed-Monad.html#Monad%27" class="link">Source</a></p><div class="doc"><p>Parameterized monads.
-</p><p>Regular monads are automatically lifted into this class through a
- (hidden) newtype constructor.
+</p><p>Regular monads can be lifted into this type class using <code><a href="Control-Indexed-Monad.html#v:lift">lift</a></code>.
 </p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:ret" class="def">ret</a> ::  t -&gt; m a a t<a href="src/Control-Indexed-Monad.html#ret" class="link">Source</a></p><div class="doc"><p>Parameterized <code><a href="/usr/local/share/doc/ghc/html/libraries/base-4.6.0.0/Control-Monad.html#v:return">return</a></code>.
 </p></div><p class="src"><a name="v:bind" class="def">bind</a> ::  m b g s -&gt; (s -&gt; m a b t) -&gt; m a g t<a href="src/Control-Indexed-Monad.html#bind" class="link">Source</a></p><div class="doc"><p>Parameterized <code><a href="/usr/local/share/doc/ghc/html/libraries/base-4.6.0.0/Control-Monad.html#v:-62--62--61-">&gt;&gt;=</a></code>.
 </p></div></div><div class="subs instances"><p id="control.i:Monad-39-" class="caption collapser" onclick="toggleSection('i:Monad-39-')">Instances</p><div id="section.i:Monad-39-" class="show"><table><tr><td class="src"><a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a> <a href="Control-Delimited.html#t:Delim">Delim</a></td><td class="doc"><p>Delimited continuations form a parameterized <code><a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a></code>.
-</p></td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:-33--62--62--61-" class="def">(!&gt;&gt;=)</a> :: <a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a> m =&gt; m b g s -&gt; (s -&gt; m a b t) -&gt; m a g t<a href="src/Control-Indexed-Monad.html#%21%3E%3E%3D" class="link">Source</a></p><div class="doc"><p>Infix synonym for <code><a href="Control-Indexed-Monad.html#v:bind">bind</a></code>.
+</p></td></tr><tr><td class="src"><a href="/usr/local/share/doc/ghc/html/libraries/base-4.6.0.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a> (<a href="Control-Indexed-Monad.html#t:MW">MW</a> m)</td><td class="doc"><p>This instances simply lifts regular instances of <code><a href="/usr/local/share/doc/ghc/html/libraries/base-4.6.0.0/Control-Monad.html#t:Monad">Monad</a></code>
+ into instances of <code><a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a></code>.
+</p></td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:MW" class="def">MW</a> m p q a <a href="src/Control-Indexed-Monad.html#MW" class="link">Source</a></p><div class="doc"><p>This type lifts any regular monad into a parameterized monad.
+</p></div><div class="subs instances"><p id="control.i:MW" class="caption collapser" onclick="toggleSection('i:MW')">Instances</p><div id="section.i:MW" class="show"><table><tr><td class="src"><a href="/usr/local/share/doc/ghc/html/libraries/base-4.6.0.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a> (<a href="Control-Indexed-Monad.html#t:MW">MW</a> m)</td><td class="doc"><p>This instances simply lifts regular instances of <code><a href="/usr/local/share/doc/ghc/html/libraries/base-4.6.0.0/Control-Monad.html#t:Monad">Monad</a></code>
+ into instances of <code><a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a></code>.
+</p></td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:lift" class="def">lift</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.6.0.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; m a -&gt; <a href="Control-Indexed-Monad.html#t:MW">MW</a> m p q a<a href="src/Control-Indexed-Monad.html#lift" class="link">Source</a></p><div class="doc"><p>This method 'lifts' a regular monad into a parameterized monad
+ <code><a href="Control-Indexed-Monad.html#t:MW">MW</a></code> which is an instance of <code><a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a></code>.
+</p></div></div><div class="top"><p class="src"><a name="v:runI" class="def">runI</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.6.0.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a href="Control-Indexed-Monad.html#t:MW">MW</a> m p q a -&gt; m a<a href="src/Control-Indexed-Monad.html#runI" class="link">Source</a></p><div class="doc"><p>This demotes a parameterized monad into a regular monad. Useful
+ for when you're using e.g. <code>RebindableSyntax</code> and want to do IO.
+</p></div></div><div class="top"><p class="src"><a name="v:-33--62--62--61-" class="def">(!&gt;&gt;=)</a> :: <a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a> m =&gt; m b g s -&gt; (s -&gt; m a b t) -&gt; m a g t<a href="src/Control-Indexed-Monad.html#%21%3E%3E%3D" class="link">Source</a></p><div class="doc"><p>Infix synonym for <code><a href="Control-Indexed-Monad.html#v:bind">bind</a></code>.
 </p></div></div><div class="top"><p class="src"><a name="v:-33--43--62--62-" class="def">(!+&gt;&gt;)</a> :: <a href="Control-Indexed-Monad.html#t:Monad-39-">Monad'</a> m =&gt; m b g s -&gt; m a b t -&gt; m a g t<a href="src/Control-Indexed-Monad.html#%21%2B%3E%3E" class="link">Source</a></p><div class="doc"><p>Defined as:
 </p><pre>m1 !+&gt;&gt; m2 = bind m1 (const m2)</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.1</p></div></body></html>

doc/asai.haddock

Binary file modified.

doc/doc-index.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>asai-0.0.0.0: A minimal library for delimited continuations. (Index)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" 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">asai-0.0.0.0: A minimal library for delimited continuations.</p></div><div id="content"><div id="index"><p class="caption">Index</p><table><tr><td class="src">!+&gt;&gt;</td><td class="module"><a href="Control-Indexed-Monad.html#v:-33--43--62--62-">Control.Indexed.Monad</a>, Control.Delimited</td></tr><tr><td class="src">!&gt;&gt;=</td><td class="module"><a href="Control-Indexed-Monad.html#v:-33--62--62--61-">Control.Indexed.Monad</a>, Control.Delimited</td></tr><tr><td class="src">bind</td><td class="module"><a href="Control-Indexed-Monad.html#v:bind">Control.Indexed.Monad</a>, Control.Delimited</td></tr><tr><td class="src">Delim</td><td class="module"><a href="Control-Delimited.html#t:Delim">Control.Delimited</a></td></tr><tr><td class="src">Monad'</td><td class="module"><a href="Control-Indexed-Monad.html#t:Monad-39-">Control.Indexed.Monad</a>, Control.Delimited</td></tr><tr><td class="src">reset</td><td class="module"><a href="Control-Delimited.html#v:reset">Control.Delimited</a></td></tr><tr><td class="src">ret</td><td class="module"><a href="Control-Indexed-Monad.html#v:ret">Control.Indexed.Monad</a>, Control.Delimited</td></tr><tr><td class="src">runDelim</td><td class="module"><a href="Control-Delimited.html#v:runDelim">Control.Delimited</a></td></tr><tr><td class="src">shift0</td><td class="module"><a href="Control-Delimited.html#v:shift0">Control.Delimited</a></td></tr><tr><td class="src">shift1</td><td class="module"><a href="Control-Delimited.html#v:shift1">Control.Delimited</a></td></tr><tr><td class="src">shift2</td><td class="module"><a href="Control-Delimited.html#v:shift2">Control.Delimited</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.1</p></div></body></html>
+</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">asai-0.0.0.0: A minimal library for delimited continuations.</p></div><div id="content"><div id="index"><p class="caption">Index</p><table><tr><td class="src">!+&gt;&gt;</td><td class="module"><a href="Control-Indexed-Monad.html#v:-33--43--62--62-">Control.Indexed.Monad</a>, Control.Delimited</td></tr><tr><td class="src">!&gt;&gt;=</td><td class="module"><a href="Control-Indexed-Monad.html#v:-33--62--62--61-">Control.Indexed.Monad</a>, Control.Delimited</td></tr><tr><td class="src">bind</td><td class="module"><a href="Control-Indexed-Monad.html#v:bind">Control.Indexed.Monad</a>, Control.Delimited</td></tr><tr><td class="src">Delim</td><td class="module"><a href="Control-Delimited.html#t:Delim">Control.Delimited</a></td></tr><tr><td class="src">lift</td><td class="module"><a href="Control-Indexed-Monad.html#v:lift">Control.Indexed.Monad</a>, Control.Delimited</td></tr><tr><td class="src">Monad'</td><td class="module"><a href="Control-Indexed-Monad.html#t:Monad-39-">Control.Indexed.Monad</a>, Control.Delimited</td></tr><tr><td class="src">MW</td><td class="module"><a href="Control-Indexed-Monad.html#t:MW">Control.Indexed.Monad</a>, Control.Delimited</td></tr><tr><td class="src">reset</td><td class="module"><a href="Control-Delimited.html#v:reset">Control.Delimited</a></td></tr><tr><td class="src">ret</td><td class="module"><a href="Control-Indexed-Monad.html#v:ret">Control.Indexed.Monad</a>, Control.Delimited</td></tr><tr><td class="src">runDelim</td><td class="module"><a href="Control-Delimited.html#v:runDelim">Control.Delimited</a></td></tr><tr><td class="src">runI</td><td class="module"><a href="Control-Indexed-Monad.html#v:runI">Control.Indexed.Monad</a>, Control.Delimited</td></tr><tr><td class="src">shift0</td><td class="module"><a href="Control-Delimited.html#v:shift0">Control.Delimited</a></td></tr><tr><td class="src">shift1</td><td class="module"><a href="Control-Delimited.html#v:shift1">Control.Delimited</a></td></tr><tr><td class="src">shift2</td><td class="module"><a href="Control-Delimited.html#v:shift2">Control.Delimited</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.1</p></div></body></html>

doc/mini_Control-Delimited-Tutorial.html

 window.onload = function () {pageLoad();};
 //]]>
 </script></head><body id="mini"><div id="module-header"><p class="caption">Control.Delimited.Tutorial</p></div><div id="interface"><h1>Introduction
-</h1><h1>Notes on <code>do</code>-notation
+</h1><h1>Using <code>do</code>-notation
+</h1><h1>Other notes
 </h1><h1>References
 </h1></div></body></html>

doc/mini_Control-Indexed-Monad.html

 window.onload = function () {pageLoad();};
 //]]>
 </script></head><body id="mini"><div id="module-header"><p class="caption">Control.Indexed.Monad</p></div><div id="interface"><h1>Parameterized monads
-</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="Control-Indexed-Monad.html#t:Monad-39-" target="main">Monad'</a> m</p></div><div class="top"><p class="src"><a href="Control-Indexed-Monad.html#v:-33--62--62--61-" target="main">(!&gt;&gt;=)</a></p></div><div class="top"><p class="src"><a href="Control-Indexed-Monad.html#v:-33--43--62--62-" target="main">(!+&gt;&gt;)</a></p></div></div></body></html>
+</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="Control-Indexed-Monad.html#t:Monad-39-" target="main">Monad'</a> m</p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="Control-Indexed-Monad.html#t:MW" target="main">MW</a> m p q a</p></div><div class="top"><p class="src"><a href="Control-Indexed-Monad.html#v:lift" target="main">lift</a></p></div><div class="top"><p class="src"><a href="Control-Indexed-Monad.html#v:runI" target="main">runI</a></p></div><div class="top"><p class="src"><a href="Control-Indexed-Monad.html#v:-33--62--62--61-" target="main">(!&gt;&gt;=)</a></p></div><div class="top"><p class="src"><a href="Control-Indexed-Monad.html#v:-33--43--62--62-" target="main">(!+&gt;&gt;)</a></p></div></div></body></html>

doc/src/Control-Delimited-Tutorial.html

 <a name="line-17"></a>       <span class='hs-layout'>(</span> <span class='hs-comment'>-- * Introduction</span>
 <a name="line-18"></a>         <span class='hs-comment'>-- $intro</span>
 <a name="line-19"></a>
-<a name="line-20"></a>         <span class='hs-comment'>-- * Notes on @do@-notation</span>
+<a name="line-20"></a>         <span class='hs-comment'>-- * Using @do@-notation</span>
 <a name="line-21"></a>         <span class='hs-comment'>-- $donotation</span>
 <a name="line-22"></a>
-<a name="line-23"></a>         <span class='hs-comment'>-- * References</span>
-<a name="line-24"></a>         <span class='hs-comment'>-- $refs</span>
-<a name="line-25"></a>       <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
-<a name="line-26"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Prelude</span> <span class='hs-varid'>hiding</span> <span class='hs-layout'>(</span><span class='hs-varid'>return</span><span class='hs-layout'>,</span> <span class='hs-varid'>fail</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>&gt;&gt;=</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>=&lt;&lt;</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
-<a name="line-27"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Delimited</span>
-<a name="line-28"></a>
-<a name="line-29"></a><span class='hs-comment'>--</span>
-<a name="line-30"></a><span class='hs-comment'>-- Aspects of RebindableSyntax</span>
-<a name="line-31"></a><span class='hs-comment'>--</span>
-<a name="line-32"></a>
-<a name="line-33"></a><a name="%3e%3e="></a><span class='hs-definition'>m</span> <span class='hs-varop'>&gt;&gt;=</span> <span class='hs-varid'>f</span>  <span class='hs-keyglyph'>=</span> <span class='hs-varid'>m</span> <span class='hs-varop'>!&gt;&gt;=</span> <span class='hs-varid'>f</span>
-<a name="line-34"></a><a name="return"></a><span class='hs-definition'>return</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>ret</span> <span class='hs-varid'>x</span>
-<a name="line-35"></a><a name="fail"></a><span class='hs-definition'>fail</span> <span class='hs-varid'>x</span>   <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-varid'>x</span>
-<a name="line-36"></a><a name="=%3c%3c"></a><span class='hs-definition'>f</span> <span class='hs-varop'>=&lt;&lt;</span> <span class='hs-varid'>m</span>  <span class='hs-keyglyph'>=</span> <span class='hs-varid'>m</span> <span class='hs-varop'>!&gt;&gt;=</span> <span class='hs-varid'>f</span>
-<a name="line-37"></a>
-<a name="line-38"></a><span class='hs-comment'>{- $intro
-<a name="line-39"></a>
-<a name="line-40"></a>Lorem ipsum...
-<a name="line-41"></a>
-<a name="line-42"></a>&gt;&gt;&gt; runDelim $ reset $ (shift1 (\_ -&gt; return "hello") &gt;&gt;= \r -&gt; return (r + 1))
-<a name="line-43"></a>"hello"
+<a name="line-23"></a>         <span class='hs-comment'>-- * Other notes</span>
+<a name="line-24"></a>         <span class='hs-comment'>-- $othernotes</span>
+<a name="line-25"></a>
+<a name="line-26"></a>         <span class='hs-comment'>-- * References</span>
+<a name="line-27"></a>         <span class='hs-comment'>-- $refs</span>
+<a name="line-28"></a>       <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
+<a name="line-29"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Prelude</span> <span class='hs-varid'>hiding</span> <span class='hs-layout'>(</span><span class='hs-varid'>return</span><span class='hs-layout'>,</span> <span class='hs-varid'>fail</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>&gt;&gt;=</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>=&lt;&lt;</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
+<a name="line-30"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Delimited</span>
+<a name="line-31"></a>
+<a name="line-32"></a><span class='hs-comment'>--</span>
+<a name="line-33"></a><span class='hs-comment'>-- Aspects of RebindableSyntax</span>
+<a name="line-34"></a><span class='hs-comment'>--</span>
+<a name="line-35"></a>
+<a name="line-36"></a><a name="%3e%3e="></a><span class='hs-definition'>m</span> <span class='hs-varop'>&gt;&gt;=</span> <span class='hs-varid'>f</span>  <span class='hs-keyglyph'>=</span> <span class='hs-varid'>m</span> <span class='hs-varop'>!&gt;&gt;=</span> <span class='hs-varid'>f</span>
+<a name="line-37"></a><a name="return"></a><span class='hs-definition'>return</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>ret</span> <span class='hs-varid'>x</span>
+<a name="line-38"></a><a name="fail"></a><span class='hs-definition'>fail</span> <span class='hs-varid'>x</span>   <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-varid'>x</span>
+<a name="line-39"></a><a name="=%3c%3c"></a><span class='hs-definition'>f</span> <span class='hs-varop'>=&lt;&lt;</span> <span class='hs-varid'>m</span>  <span class='hs-keyglyph'>=</span> <span class='hs-varid'>m</span> <span class='hs-varop'>!&gt;&gt;=</span> <span class='hs-varid'>f</span>
+<a name="line-40"></a>
+<a name="line-41"></a><span class='hs-comment'>{- $intro
+<a name="line-42"></a>
+<a name="line-43"></a>Lorem ipsum...
 <a name="line-44"></a>
-<a name="line-45"></a>-}</span>
-<a name="line-46"></a>
-<a name="line-47"></a><span class='hs-comment'>{- $donotation
-<a name="line-48"></a>
-<a name="line-49"></a>Lorem ipsum...
-<a name="line-50"></a>
-<a name="line-51"></a>-}</span>
-<a name="line-52"></a>
-<a name="line-53"></a><span class='hs-comment'>{- $refs
+<a name="line-45"></a>&gt;&gt;&gt; runDelim $ reset $ (shift1 (\_ -&gt; return "hello") &gt;&gt;= \r -&gt; return (r + 1))
+<a name="line-46"></a>"hello"
+<a name="line-47"></a>
+<a name="line-48"></a>-}</span>
+<a name="line-49"></a>
+<a name="line-50"></a><span class='hs-comment'>{- $donotation
+<a name="line-51"></a>
+<a name="line-52"></a>It's possible to use GHC's @RebindableSyntax@ extension to re-define
+<a name="line-53"></a>@do@ notation to use the 'Monad'' type class.
 <a name="line-54"></a>
-<a name="line-55"></a>  * /Polymorphic Delimited Continuations/, by Asai, Kameyama in /APLAS '07/:
-<a name="line-56"></a>    &lt;<a href="http://logic.cs.tsukuba.ac.jp/~kam/paper/aplas07.pdf">http://logic.cs.tsukuba.ac.jp/~kam/paper/aplas07.pdf</a>&gt;
-<a name="line-57"></a>
-<a name="line-58"></a>  * /Genuine shift\reset in Haskell98/, by Kiselyov, on /haskell-cafe/:
-<a name="line-59"></a>    &lt;<a href="http://okmij.org/ftp/continuations/implementations.html#genuine-shift">http://okmij.org/ftp/continuations/implementations.html#genuine-shift</a>&gt;
+<a name="line-55"></a>Begin your module by hiding the regular 'Monad' methods, and then
+<a name="line-56"></a>redefine 'Prelude.&gt;&gt;=' and 'Prelude.return'. Feel free to redefine
+<a name="line-57"></a>other operators too. Here's an example (you'll need to fix the
+<a name="line-58"></a>@LANGUAGE@ pragma yourself on the first line, since Haddock eats it
+<a name="line-59"></a>otherwise):
 <a name="line-60"></a>
-<a name="line-61"></a>  * /Introduction to programming with shift and reset/, by Kiselyov, Asai, in /CW2011/:
-<a name="line-62"></a>    &lt;<a href="http://okmij.org/ftp/continuations/index.html#tutorial">http://okmij.org/ftp/continuations/index.html#tutorial</a>&gt;
-<a name="line-63"></a>
-<a name="line-64"></a>-}</span>
+<a name="line-61"></a>&gt; [-# LANGUAGE RebindableSyntax #-]
+<a name="line-62"></a>&gt; module Foo where
+<a name="line-63"></a>&gt; import Prelude hiding (return, fail, (&gt;&gt;=), (=&lt;&lt;), (&gt;&gt;))
+<a name="line-64"></a>&gt; import Control.Delimited
+<a name="line-65"></a>&gt;
+<a name="line-66"></a>&gt; -- Aspects of RebindableSyntax
+<a name="line-67"></a>&gt; return x = ret x
+<a name="line-68"></a>&gt; fail s   = error s
+<a name="line-69"></a>&gt; m &gt;&gt;= f  = m !&gt;&gt;= f
+<a name="line-70"></a>&gt; f =&lt;&lt; m  = m !&gt;&gt;= f
+<a name="line-71"></a>&gt; f &gt;&gt; k   = m !&gt;&gt;= \_ -&gt; k
+<a name="line-72"></a>&gt;
+<a name="line-73"></a>&gt; -- Now use 'do' notation instead of the indexed bind/return
+<a name="line-74"></a>&gt; -- functions.
+<a name="line-75"></a>&gt;
+<a name="line-76"></a>&gt; -- You can lift regular monads into parameterized monads using
+<a name="line-77"></a>&gt; -- 'lift' and 'runI'
+<a name="line-78"></a>&gt; io1 :: IO ()
+<a name="line-79"></a>&gt; io1 = runI $ do
+<a name="line-80"></a>&gt;   lift $ putStrLn "hi!"
+<a name="line-81"></a>&gt;   lift $ putStrLn "hi!"
+<a name="line-82"></a>&gt;   return ()
+<a name="line-83"></a>&gt;
+<a name="line-84"></a>&gt; test1 :: String
+<a name="line-85"></a>&gt; test1 = runDelim $ reset $ do
+<a name="line-86"></a>&gt;   r &lt;- shift1 (\_ -&gt; return "hello")
+<a name="line-87"></a>&gt;   return (r + 1)
+<a name="line-88"></a>&gt; -- This is equivalent to the OchaCaml term:
+<a name="line-89"></a>&gt; --   reset (fun () -&gt; 1 + shift (fun _ -&gt; "hello")) ;;
+<a name="line-90"></a>
+<a name="line-91"></a>See @examples/Simple.hs@ (included in the distribution) for several
+<a name="line-92"></a>more examples.
+<a name="line-93"></a>
+<a name="line-94"></a>-}</span>
+<a name="line-95"></a>
+<a name="line-96"></a><span class='hs-comment'>{- $othernotes
+<a name="line-97"></a>
+<a name="line-98"></a>This package requires GHC's @RankNTypes@ extension, as it uses it for
+<a name="line-99"></a>the definition of 'Control.Delimited.shift2'. The original
+<a name="line-100"></a>implementation by Kiselyov is Haskell98. You do not need to enable
+<a name="line-101"></a>@RankNTypes@ to use this package.
+<a name="line-102"></a>
+<a name="line-103"></a>-}</span>
+<a name="line-104"></a>
+<a name="line-105"></a><span class='hs-comment'>{- $refs
+<a name="line-106"></a>
+<a name="line-107"></a>  * /Polymorphic Delimited Continuations/, by Asai, Kameyama in /APLAS '07/:
+<a name="line-108"></a>    &lt;<a href="http://logic.cs.tsukuba.ac.jp/~kam/paper/aplas07.pdf">http://logic.cs.tsukuba.ac.jp/~kam/paper/aplas07.pdf</a>&gt;
+<a name="line-109"></a>
+<a name="line-110"></a>  * /Genuine shift\reset in Haskell98/, by Kiselyov, on /haskell-cafe/:
+<a name="line-111"></a>    &lt;<a href="http://okmij.org/ftp/continuations/implementations.html#genuine-shift">http://okmij.org/ftp/continuations/implementations.html#genuine-shift</a>&gt;
+<a name="line-112"></a>
+<a name="line-113"></a>  * /Introduction to programming with shift and reset/, by Kiselyov, Asai, in /CW2011/:
+<a name="line-114"></a>    &lt;<a href="http://okmij.org/ftp/continuations/index.html#tutorial">http://okmij.org/ftp/continuations/index.html#tutorial</a>&gt;
+<a name="line-115"></a>
+<a name="line-116"></a>-}</span>
 </pre></body>
 </html>

doc/src/Control-Delimited.html

 <a name="line-19"></a>       <span class='hs-layout'>,</span> <span class='hs-varid'>reset</span>     <span class='hs-comment'>-- :: Delim s t s -&gt; Delim s' s' t</span>
 <a name="line-20"></a>
 <a name="line-21"></a>         <span class='hs-comment'>-- ** A family of shift operators</span>
-<a name="line-22"></a>       <span class='hs-layout'>,</span> <span class='hs-varid'>shift0</span>    <span class='hs-comment'>--</span>
-<a name="line-23"></a>       <span class='hs-layout'>,</span> <span class='hs-varid'>shift1</span>    <span class='hs-comment'>--</span>
-<a name="line-24"></a>       <span class='hs-layout'>,</span> <span class='hs-varid'>shift2</span>    <span class='hs-comment'>--</span>
+<a name="line-22"></a>       <span class='hs-layout'>,</span> <span class='hs-varid'>shift0</span>    <span class='hs-comment'>-- :: ((b -&gt; s) -&gt; t) -&gt; Delim s t b</span>
+<a name="line-23"></a>       <span class='hs-layout'>,</span> <span class='hs-varid'>shift1</span>    <span class='hs-comment'>-- :: ((b -&gt; s) -&gt; Delim a t a) -&gt; Delim s t b</span>
+<a name="line-24"></a>       <span class='hs-layout'>,</span> <span class='hs-varid'>shift2</span>    <span class='hs-comment'>-- :: ((b -&gt; forall a'.  Delim a' a' s) -&gt; Delim a t a) -&gt; Delim s t b</span>
 <a name="line-25"></a>
 <a name="line-26"></a>         <span class='hs-comment'>-- ** Executing delimited computations</span>
 <a name="line-27"></a>       <span class='hs-layout'>,</span> <span class='hs-varid'>runDelim</span>  <span class='hs-comment'>-- :: Delim t t t -&gt; t</span>

doc/src/Control-Indexed-Monad.html

 <a name="line-15"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Indexed</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span>
 <a name="line-16"></a>       <span class='hs-layout'>(</span> <span class='hs-comment'>-- * Parameterized monads</span>
 <a name="line-17"></a>         <span class='hs-conid'>Monad'</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span> <span class='hs-comment'>-- :: (* -&gt; * -&gt; * -&gt; *) -&gt; Constraint</span>
-<a name="line-18"></a>       <span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>!&gt;&gt;=</span><span class='hs-layout'>)</span>     <span class='hs-comment'>-- :: Monad' m =&gt; m b g s -&gt; (s -&gt; m a b t) -&gt; m a g t</span>
-<a name="line-19"></a>       <span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>!+&gt;&gt;</span><span class='hs-layout'>)</span>     <span class='hs-comment'>-- :: Monad' m =&gt; m b g s -&gt; m a b t -&gt; m a g t</span>
-<a name="line-20"></a>       <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
-<a name="line-21"></a>
-<a name="line-22"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span>
-<a name="line-23"></a><span class='hs-comment'>-- Parameterized monads.</span>
+<a name="line-18"></a>       <span class='hs-layout'>,</span> <span class='hs-conid'>MW</span>         <span class='hs-comment'>-- :: (* -&gt; *) -&gt; * -&gt; * -&gt; * -&gt; *</span>
+<a name="line-19"></a>       <span class='hs-layout'>,</span> <span class='hs-varid'>lift</span>       <span class='hs-comment'>-- :: Monad m =&gt; m a -&gt; MW m p q a</span>
+<a name="line-20"></a>       <span class='hs-layout'>,</span> <span class='hs-varid'>runI</span>       <span class='hs-comment'>-- :: Monad m =&gt; MW m p q a -&gt; m a</span>
+<a name="line-21"></a>       <span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>!&gt;&gt;=</span><span class='hs-layout'>)</span>     <span class='hs-comment'>-- :: Monad' m =&gt; m b g s -&gt; (s -&gt; m a b t) -&gt; m a g t</span>
+<a name="line-22"></a>       <span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>!+&gt;&gt;</span><span class='hs-layout'>)</span>     <span class='hs-comment'>-- :: Monad' m =&gt; m b g s -&gt; m a b t -&gt; m a g t</span>
+<a name="line-23"></a>       <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
 <a name="line-24"></a>
-<a name="line-25"></a><a name="Monad'"></a><span class='hs-comment'>-- | Parameterized monads.</span>
-<a name="line-26"></a><a name="Monad'"></a><span class='hs-comment'>--</span>
-<a name="line-27"></a><a name="Monad'"></a><span class='hs-comment'>-- Regular monads are automatically lifted into this class through a</span>
-<a name="line-28"></a><a name="Monad'"></a><span class='hs-comment'>-- (hidden) newtype constructor.</span>
-<a name="line-29"></a><a name="Monad'"></a><span class='hs-keyword'>class</span> <span class='hs-conid'>Monad'</span> <span class='hs-varid'>m</span> <span class='hs-keyword'>where</span>
-<a name="line-30"></a>  <span class='hs-comment'>-- | Parameterized 'Prelude.return'.</span>
-<a name="line-31"></a>  <span class='hs-varid'>ret</span>  <span class='hs-keyglyph'>::</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>a</span> <span class='hs-varid'>t</span>
-<a name="line-32"></a>  <span class='hs-comment'>-- | Parameterized 'Prelude.&gt;&gt;='.</span>
-<a name="line-33"></a>  <span class='hs-varid'>bind</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span> <span class='hs-varid'>g</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>g</span> <span class='hs-varid'>t</span>
-<a name="line-34"></a>
-<a name="line-35"></a><a name="MW"></a><span class='hs-comment'>-- | This newtype lifts any regular monad into a parameterized monad.</span>
-<a name="line-36"></a><a name="MW"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>MW</span> <span class='hs-varid'>m</span> <span class='hs-varid'>p</span> <span class='hs-varid'>q</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>MW</span> <span class='hs-layout'>{</span> <span class='hs-varid'>unMW</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-layout'>}</span>
-<a name="line-37"></a>
-<a name="line-38"></a><a name="instance%20Monad'%20(MW%20m)"></a><span class='hs-comment'>-- | This instances simply lifts regular instances of 'Monad'</span>
-<a name="line-39"></a><a name="instance%20Monad'%20(MW%20m)"></a><span class='hs-comment'>-- into instances of 'Monad''.</span>
-<a name="line-40"></a><a name="instance%20Monad'%20(MW%20m)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Monad'</span> <span class='hs-layout'>(</span><span class='hs-conid'>MW</span> <span class='hs-varid'>m</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
-<a name="line-41"></a>  <span class='hs-varid'>ret</span>         <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>MW</span> <span class='hs-layout'>(</span><span class='hs-varid'>return</span> <span class='hs-varid'>x</span><span class='hs-layout'>)</span>
-<a name="line-42"></a>  <span class='hs-varid'>bind</span> <span class='hs-layout'>(</span><span class='hs-conid'>MW</span> <span class='hs-varid'>m</span><span class='hs-layout'>)</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>MW</span> <span class='hs-layout'>(</span><span class='hs-varid'>m</span> <span class='hs-varop'>&gt;&gt;=</span> <span class='hs-varid'>unMW</span> <span class='hs-varop'>.</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span>
-<a name="line-43"></a>
-<a name="line-44"></a><a name="!%3e%3e="></a><span class='hs-comment'>-- | Infix synonym for 'bind'.</span>
-<a name="line-45"></a><span class='hs-layout'>(</span><span class='hs-varop'>!&gt;&gt;=</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad'</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span> <span class='hs-varid'>g</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>g</span> <span class='hs-varid'>t</span>
-<a name="line-46"></a><a name="m"></a><span class='hs-definition'>m</span> <span class='hs-varop'>!&gt;&gt;=</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>bind</span> <span class='hs-varid'>m</span> <span class='hs-varid'>f</span>
-<a name="line-47"></a><span class='hs-keyword'>infixl</span> <span class='hs-num'>1</span> <span class='hs-varop'>!&gt;&gt;=</span>
-<a name="line-48"></a>
-<a name="line-49"></a><a name="!+%3e%3e"></a><span class='hs-comment'>-- | Defined as:</span>
-<a name="line-50"></a><span class='hs-comment'>--</span>
-<a name="line-51"></a><span class='hs-comment'>-- @m1 !+&gt;&gt; m2 = bind m1 (const m2)@</span>
-<a name="line-52"></a><span class='hs-layout'>(</span><span class='hs-varop'>!+&gt;&gt;</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad'</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span> <span class='hs-varid'>g</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>g</span> <span class='hs-varid'>t</span>
-<a name="line-53"></a><a name="m1"></a><span class='hs-definition'>m1</span> <span class='hs-varop'>!+&gt;&gt;</span> <span class='hs-varid'>m2</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>bind</span> <span class='hs-varid'>m1</span> <span class='hs-layout'>(</span><span class='hs-varid'>const</span> <span class='hs-varid'>m2</span><span class='hs-layout'>)</span>
-<a name="line-54"></a><span class='hs-keyword'>infixl</span> <span class='hs-num'>1</span> <span class='hs-varop'>!+&gt;&gt;</span>
+<a name="line-25"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span>
+<a name="line-26"></a><span class='hs-comment'>-- Parameterized monads.</span>
+<a name="line-27"></a>
+<a name="line-28"></a><a name="Monad'"></a><span class='hs-comment'>-- | Parameterized monads.</span>
+<a name="line-29"></a><a name="Monad'"></a><span class='hs-comment'>--</span>
+<a name="line-30"></a><a name="Monad'"></a><span class='hs-comment'>-- Regular monads can be lifted into this type class using 'lift'.</span>
+<a name="line-31"></a><a name="Monad'"></a><span class='hs-keyword'>class</span> <span class='hs-conid'>Monad'</span> <span class='hs-varid'>m</span> <span class='hs-keyword'>where</span>
+<a name="line-32"></a>  <span class='hs-comment'>-- | Parameterized 'Prelude.return'.</span>
+<a name="line-33"></a>  <span class='hs-varid'>ret</span>  <span class='hs-keyglyph'>::</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>a</span> <span class='hs-varid'>t</span>
+<a name="line-34"></a>  <span class='hs-comment'>-- | Parameterized 'Prelude.&gt;&gt;='.</span>
+<a name="line-35"></a>  <span class='hs-varid'>bind</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span> <span class='hs-varid'>g</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>g</span> <span class='hs-varid'>t</span>
+<a name="line-36"></a>
+<a name="line-37"></a><a name="MW"></a><span class='hs-comment'>-- | This type lifts any regular monad into a parameterized monad.</span>
+<a name="line-38"></a><a name="MW"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>MW</span> <span class='hs-varid'>m</span> <span class='hs-varid'>p</span> <span class='hs-varid'>q</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>MW</span> <span class='hs-layout'>{</span> <span class='hs-varid'>unMW</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-layout'>}</span>
+<a name="line-39"></a>
+<a name="line-40"></a><a name="lift"></a><span class='hs-comment'>-- | This method \'lifts\' a regular monad into a parameterized monad</span>
+<a name="line-41"></a><span class='hs-comment'>-- 'MW' which is an instance of 'Monad''.</span>
+<a name="line-42"></a><span class='hs-definition'>lift</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>MW</span> <span class='hs-varid'>m</span> <span class='hs-varid'>p</span> <span class='hs-varid'>q</span> <span class='hs-varid'>a</span>
+<a name="line-43"></a><span class='hs-definition'>lift</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>MW</span>
+<a name="line-44"></a>
+<a name="line-45"></a><a name="runI"></a><span class='hs-comment'>-- | This demotes a parameterized monad into a regular monad. Useful</span>
+<a name="line-46"></a><span class='hs-comment'>-- for when you're using e.g. @RebindableSyntax@ and want to do IO.</span>
+<a name="line-47"></a><span class='hs-definition'>runI</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>MW</span> <span class='hs-varid'>m</span> <span class='hs-varid'>p</span> <span class='hs-varid'>q</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span>
+<a name="line-48"></a><span class='hs-definition'>runI</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>unMW</span>
+<a name="line-49"></a>
+<a name="line-50"></a><a name="instance%20Monad'%20(MW%20m)"></a><span class='hs-comment'>-- | This instances simply lifts regular instances of 'Monad'</span>
+<a name="line-51"></a><a name="instance%20Monad'%20(MW%20m)"></a><span class='hs-comment'>-- into instances of 'Monad''.</span>
+<a name="line-52"></a><a name="instance%20Monad'%20(MW%20m)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Monad'</span> <span class='hs-layout'>(</span><span class='hs-conid'>MW</span> <span class='hs-varid'>m</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
+<a name="line-53"></a>  <span class='hs-varid'>ret</span>         <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>MW</span> <span class='hs-layout'>(</span><span class='hs-varid'>return</span> <span class='hs-varid'>x</span><span class='hs-layout'>)</span>
+<a name="line-54"></a>  <span class='hs-varid'>bind</span> <span class='hs-layout'>(</span><span class='hs-conid'>MW</span> <span class='hs-varid'>m</span><span class='hs-layout'>)</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>MW</span> <span class='hs-layout'>(</span><span class='hs-varid'>m</span> <span class='hs-varop'>&gt;&gt;=</span> <span class='hs-varid'>unMW</span> <span class='hs-varop'>.</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span>
+<a name="line-55"></a>
+<a name="line-56"></a><a name="!%3e%3e="></a><span class='hs-comment'>-- | Infix synonym for 'bind'.</span>
+<a name="line-57"></a><span class='hs-layout'>(</span><span class='hs-varop'>!&gt;&gt;=</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad'</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span> <span class='hs-varid'>g</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>g</span> <span class='hs-varid'>t</span>
+<a name="line-58"></a><a name="m"></a><span class='hs-definition'>m</span> <span class='hs-varop'>!&gt;&gt;=</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>bind</span> <span class='hs-varid'>m</span> <span class='hs-varid'>f</span>
+<a name="line-59"></a><span class='hs-keyword'>infixl</span> <span class='hs-num'>1</span> <span class='hs-varop'>!&gt;&gt;=</span>
+<a name="line-60"></a>
+<a name="line-61"></a><a name="!+%3e%3e"></a><span class='hs-comment'>-- | Defined as:</span>
+<a name="line-62"></a><span class='hs-comment'>--</span>
+<a name="line-63"></a><span class='hs-comment'>-- @m1 !+&gt;&gt; m2 = bind m1 (const m2)@</span>
+<a name="line-64"></a><span class='hs-layout'>(</span><span class='hs-varop'>!+&gt;&gt;</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad'</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span> <span class='hs-varid'>g</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-varid'>g</span> <span class='hs-varid'>t</span>
+<a name="line-65"></a><a name="m1"></a><span class='hs-definition'>m1</span> <span class='hs-varop'>!+&gt;&gt;</span> <span class='hs-varid'>m2</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>bind</span> <span class='hs-varid'>m1</span> <span class='hs-layout'>(</span><span class='hs-varid'>const</span> <span class='hs-varid'>m2</span><span class='hs-layout'>)</span>
+<a name="line-66"></a><span class='hs-keyword'>infixl</span> <span class='hs-num'>1</span> <span class='hs-varop'>!+&gt;&gt;</span>
 </pre></body>
 </html>