FWIW, I maintain, according to wc and sloccount, 220841 lines worth of Haskell code at present.<div><br></div><div>I have been bitten this error one time, so it affects me .000045% of the time and that was only because it was in the only package I was not using -Wall on.</div>
<div><br></div><div>-Edward<br><br><div class="gmail_quote">On Wed, Jul 17, 2013 at 12:23 PM, Andreas Abel <span dir="ltr">&lt;<a href="mailto:andreas.abel@ifi.lmu.de" target="_blank">andreas.abel@ifi.lmu.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here, again, is your ACTUAL CODE, commented, deployed, looping, and maybe linked into your projects, if you are not careless about the cabal constraints:<br>

<br>
<a href="http://hackage.haskell.org/packages/archive/mtl/2.1/doc/html/src/Control-Monad-State-Class.html#state" target="_blank">http://hackage.haskell.org/<u></u>packages/archive/mtl/2.1/doc/<u></u>html/src/Control-Monad-State-<u></u>Class.html#state</a><br>

<br>
    -- | Embed a simple state action into the monad.<br>
    state :: (s -&gt; (a, s)) -&gt; m a<br>
    state f = do<br>
      s &lt;- get<br>
      let ~(a, s) = f s<br>
      put s<br>
      return a<br>
<br>
Have fun with it,<br>
Andreas<div class="HOEnZb"><div class="h5"><br>
<br>
On 17.07.2013 02:20, Richard A. O&#39;Keefe wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Brian Marick sent me a couple of his stickers.<br>
The one I have on my door reads &quot;to be less wrong than yesterday&quot;.<br>
The other one I keep free to bring out and wave around:<br>
<br>
        &quot;An example would be handy about now.&quot;<br>
<br>
All of the arguing to and fro -- including mine! -- about<br>
non-recursive let has been just so much hot air.  I could<br>
go on about how the distinction between &#39;val&#39; and &#39;val rec&#39;<br>
in ML was one of the things I came to dislike intensely,<br>
and how Haskell&#39;s single coherent approach is one of the<br>
things that attracted me to Haskell.<br>
<br>
But why should anyone else care?<br>
<br>
When presented with a difficulty, it is very common for some<br>
functional language users to propose adding just one more<br>
feature from some other language, commonly an imperative one<br>
(which ML, Caml, and F# arguably are).  Typically this is<br>
something that _would_ solve the immediate problem but would<br>
create worse problems elsewhere, and there is some other<br>
solution, either one already available in the language, or a<br>
better one that would solve additional problems or cause<br>
fewer ones.<br>
<br>
The best help for any discussion is A CONCRETE EXAMPLE OF<br>
REAL CODE.  Not little sketches hacked up for the purpose<br>
of discussion, but ACTUAL CODE.  The person who initially<br>
proposes a problem may think some details are not relevant,<br>
whereas someone else may see them as the key to the solution.<br>
<br>
For example, looking at some code in another mostly-<br>
functional language, which had been presented as reason why<br>
we needed a new construct, I rewrote it in less than half<br>
the number of lines using existing constructors, using only<br>
existing features.<br>
<br>
Without seeing THE ACTUAL CODE that prompted this thread,<br>
it is impossible to tell whether that might be the case here.<br>
<br>
In this specific case, we are seeing state being threaded<br>
through a bunch of updates, and IN THE ABSENCE OF THE ACTUAL<br>
CODE, it seems to me that monad notation is the most<br>
intention-revealing notation available for the purpose in<br>
Haskell, and if Haskell did have non-recursive let it would<br>
STILL be best to write such code using a state monad so that<br>
human beings reading the Haskell code would have some idea<br>
of what was happening, because that&#39;s how state changes are<br>
supposed to be expressed in Haskell, and anything else<br>
counts as obfuscation.<br>
<br>
But THE ACTUAL CODE might show that this case was different<br>
in some important way.<br>
<br>
<br>
<br>
______________________________<u></u>_________________<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/<u></u>mailman/listinfo/haskell-cafe</a><br>
<br>
</blockquote>
<br>
<br></div></div><div class="im HOEnZb">
-- <br>
Andreas Abel  &lt;&gt;&lt;      Du bist der geliebte Mensch.<br>
<br>
Theoretical Computer Science, University of Munich<br>
Oettingenstr. 67, D-80538 Munich, GERMANY<br>
<br>
<a href="mailto:andreas.abel@ifi.lmu.de" target="_blank">andreas.abel@ifi.lmu.de</a><br>
<a href="http://www2.tcs.ifi.lmu.de/~abel/" target="_blank">http://www2.tcs.ifi.lmu.de/~<u></u>abel/</a><br>
<br></div><div class="HOEnZb"><div class="h5">
______________________________<u></u>_________________<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/<u></u>mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div>