<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 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>