<p>I meant that &#39;pop&#39; and &#39;push&#39; should have been written with &#39;modify&#39;, &#39;get&#39;, and &#39;set&#39; instead of the raw constructor, not as a drop-in replacement.</p>
<p>I can show you examples later if this isn&#39;t clear, unless I&#39;m not understanding your code above.</p>
<p>Antoine</p>
<div class="gmail_quote">On Nov 24, 2010 10:46 AM, &quot;Adam Miezianko&quot; &lt;<a href="mailto:adam@theorylounge.org">adam@theorylounge.org</a>&gt; wrote:<br type="attribution">&gt; On Wed, 24 Nov 2010 06:17:47 -0800, Antoine Latter &lt;<a href="mailto:aslatter@gmail.com">aslatter@gmail.com</a>&gt;  <br>
&gt; wrote:<br>&gt; <br>&gt;&gt; On Tue, Nov 23, 2010 at 6:58 PM, Adam Miezianko &lt;<a href="mailto:adam@theorylounge.org">adam@theorylounge.org</a>&gt;  <br>&gt;&gt; wrote:<br>&gt;&gt;&gt; I&#39;m working through Learn You a Haskell for Great Good [1] and getting<br>
&gt;&gt;&gt; a compiler error while playing around with some of the code.  I have<br>&gt;&gt;&gt; this:<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; pop :: State Stack Int<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; But when I try to load it into ghci I get the following errors:<br>
&gt;&gt;&gt;<br>&gt;&gt;&gt;  /home/admi/.pe/state.hs:6:6: Not in scope: data constructor `State&#39;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Now, I&#39;m not exactly sure how to read the documentation for<br>&gt;&gt;&gt; Control.Monad.State [2] but it seems that newtype State s a = State<br>
&gt;&gt;&gt; {...} defines a constructor, or am I wrong on that point too?  So,<br>&gt;&gt;&gt; what am I missing here?  In case it matters, I am using mtl-2.0.1.0<br>&gt;&gt;&gt; and ghci 6.12.3.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; [1] <a href="http://learnyouahaskell.com/for-a-few-monads-more">http://learnyouahaskell.com/for-a-few-monads-more</a><br>
&gt;&gt;&gt; [2]  <br>&gt;&gt;&gt; <a href="http://cvs.haskell.org/Hugs/pages/libraries/mtl/Control-Monad-State.html">http://cvs.haskell.org/Hugs/pages/libraries/mtl/Control-Monad-State.html</a><br>&gt;&gt;&gt;<br>&gt;&gt;<br>
&gt;&gt; It looks like your documentation doesn&#39;t match the library you&#39;re using.<br>&gt;&gt;<br>&gt;&gt; The documentation for mtl-2.x is here:  <br>&gt;&gt; <a href="http://hackage.haskell.org/package/mtl">http://hackage.haskell.org/package/mtl</a><br>
&gt; <br>&gt; Thanks!<br>&gt; <br>&gt; My documentation didn&#39;t have any version identification, so discovering  <br>&gt; that there was a breaking interface change is no surprise now.  Next time  <br>&gt; hoogle doesn&#39;t return me what I want I&#39;ll first suspect it&#39;s been removed  <br>
&gt; before questioning the accuracy of the search results.<br>&gt; <br>&gt; On a somewhat related note, I also found the link you provide, but I found  <br>&gt; <a href="http://hackage.haskell.org">hackage.haskell.org</a> to be intermittently timing out for me this last week.<br>
&gt; <br>&gt;&gt; However you might be better served using the &#39;modify&#39; function.<br>&gt; <br>&gt; Looking at the type signature of modify, I&#39;m unsure how to use it.  It  <br>&gt; does not look like I can just drop it in as a replacement for State  <br>
&gt; (StateT, state).  Could someone provide an example?  The tutorials seem to  <br>&gt; mostly use the State constructor that&#39;s now gone.<br>&gt; <br>&gt; --<br>&gt; Adam Miezianko<br></div>