<div>Well, there are a few approaches available.</div>
<div> </div>
<div>On the supply front you have the MonadSupply and MonadUnique proposals from the wiki:</div>
<div> </div>
<div><a href="http://www.haskell.org/haskellwiki/New_monads/MonadSupply">http://www.haskell.org/haskellwiki/New_monads/MonadSupply</a></div>
<div><a href="http://www.haskell.org/haskellwiki/New_monads/MonadUnique">http://www.haskell.org/haskellwiki/New_monads/MonadUnique</a></div>
<div><br>and of course, the ability to roll your own using the State monad.</div>
<div> </div>
<div>Somewhat more satisfying at least my my esoteric interests, is that if you&#39;re willing to turn your entire thinking on its ear there is a unique supply comonad. </div>
<div> </div>
<div><a href="http://comonad.com/haskell/category-extras/dist/doc/html/category-extras/Control-Comonad-Supply.html">http://comonad.com/haskell/category-extras/dist/doc/html/category-extras/Control-Comonad-Supply.html</a></div>

<div> </div>
<div>which I seem to recall was also available as Data.Supply.</div>
<div> </div>
<div>The main issue with generalizing consumption of input is what does it entail? when you are parsing a list do you have one element at a time consumption? or do you have the ability to grab a whole prefix at once? These issues tend to push you towards the use of the State monad anyways.</div>

<div> </div>
<div>-Edward Kmett</div>
<div> </div>
<div class="gmail_quote">On Mon, Mar 30, 2009 at 3:29 PM, Andrew Coppin <span dir="ltr">&lt;<a href="mailto:andrewcoppin@btinternet.com">andrewcoppin@btinternet.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Maybe I&#39;m just being blind here, but I don&#39;t see a monad transformer (or even a monad) in the standard libraries for producing &quot;unique&quot; values. Have I missed something?<br>
<br>Related, I don&#39;t see a monad for gradually consuming input. We&#39;ve got the Reader monad, but that appears to just give you global access to a single monolithic value. That value could be some kind of collection, but there&#39;s no way to track where you&#39;ve read up to (or efficiently access that point). We&#39;ve got Parsec, which is a pretty efficient and powerful text parser. But what if you don&#39;t need full parsing capabilities? You just need to consume input, but you&#39;re not exactly sure where you&#39;re going to consume it? The Writer monad seems to let you incrimentally write values out, but there&#39;s no matching monad for incrimentally reading stuff back in.<br>
<br>(I guess ultimately you can build all these specialised monads out of the general State monad if you want. I&#39;m just surprised they&#39;re not already defined somewhere...)<br><br><br>_______________________________________________<br>
Haskell-Cafe mailing list<br><a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br>