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