<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Thank you very much!<br>
    <br>
    <div class="moz-cite-prefix">On 4/17/15 6:48 PM, Mike Meyer wrote:<br>
    </div>
    <blockquote
cite="mid:CAD=7U2AN-h2HSZMBDa0HDL4wmNN1TpbLmuVe4oCXz15hKSA+sA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Fri, Apr 17, 2015 at 2:25 PM,
            Thomas Jakway <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:tjakway@nyu.edu" target="_blank">tjakway@nyu.edu</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000">genThree listMax =
                do --highest index in the list<br>
                        let listMin = 0 :: Int --lowest index in the
                list<br>
                        generatedMin <- state randomR (listMin,
                listMax)<br>
                        return generatedMin<br>
              </div>
            </blockquote>
          </div>
          <br>
          What you're missing is a $:</div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra">The only chagne to our genThree
          functions is making it "state $" instead of "state". </div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra">#!/usr/bin/env runhaskell</div>
        <div class="gmail_extra">
          <div class="gmail_extra"><br>
          </div>
          <div class="gmail_extra">import System.Random</div>
          <div class="gmail_extra">import Control.Monad.State</div>
          <div class="gmail_extra"><br>
          </div>
          <div class="gmail_extra">genThree listMax = do --highest index
            in the list<br>
          </div>
          <div class="gmail_extra">        let listMin = 0 :: Int
            --lowest index in the list</div>
          <div class="gmail_extra">        generatedMin <- state $
            randomR (listMin, listMax)</div>
          <div class="gmail_extra">        return generatedMin</div>
          <div class="gmail_extra"><br>
          </div>
          <div class="gmail_extra">main = do<br>
          </div>
          <div class="gmail_extra">  gen <- newStdGen</div>
          <div class="gmail_extra">  print $ evalState (genThree 10) gen</div>
          <div><br>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>