In the latest version of mtl, there is no State data constructor.<div><br></div><div><a href="http://hackage.haskell.org/packages/archive/mtl/latest/doc/html/Control-Monad-State-Lazy.html#g:2">http://hackage.haskell.org/packages/archive/mtl/latest/doc/html/Control-Monad-State-Lazy.html#g:2</a></div>
<div><br></div><div><a href="http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-State-Lazy.html#t:State">State</a> is defined to be a type alias to the application of Identity monad to the StateT monad transformer.</div>
<div><br></div><div>As you&#39;ve already discovered, you need to use <a href="http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-State-Lazy.html#v:state">state</a> instead.</div>
<div><br></div><div>HTH,</div><div><br></div><div>Ozgur<br><br><div class="gmail_quote">On 14 February 2011 18:11, Britt Anderson <span dir="ltr">&lt;<a href="mailto:britt.uwaterloo@gmail.com">britt.uwaterloo@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Many of the tutorials on the state monad seem to suggest that you can use State as a data constructor, but I can&#39;t get this to work. E.g. in ghci after :m Control.Monad.State I can <br>
<br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">let f = (\x -&gt; (x,x))</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">let y = state f</span><br><br>but if I,<br>
<br><span style="font-family:courier new,monospace">let z = State f</span><br><br>I get an error message: Not in scope: data constructor `State&#39;. <br><br>Can someone please explain?<br><br>Thanks, Britt<br><br>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Ozgur Akgun<br>
</div>