You can try at the top<br>Import Prelude hiding (>>)<br><br><div class="gmail_quote">On Wed, Apr 22, 2009 at 10:44 AM, michael rice <span dir="ltr"><<a href="mailto:nowgate@yahoo.com">nowgate@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
I've been working through this example from: <a href="http://en.wikibooks.org/wiki/Haskell/Understanding_monads" target="_blank">http://en.wikibooks.org/wiki/Haskell/Understanding_monads</a><br><br>I understand what they're doing all the way up to the definition of (>>), which duplicates Prelude function (>>). To continue following the example, I need to know how to override the Prelude (>>) with the (>>) definition in my file rand.hs.<br>
<br>Michael<br><br>==============<br><br>[michael@localhost ~]$ cat rand.hs<br>import System.Random<br><br>type Seed = Int<br><br>randomNext :: Seed -> Seed<br>randomNext rand = if newRand > 0 then newRand else newRand + 2147483647<br>
where newRand = 16807 * lo - 2836 * hi<br> (hi,lo) = rand `divMod` 127773<br><br>toDieRoll :: Seed -> Int<br>toDieRoll seed = (seed `mod` 6) + 1<br><br>rollDie :: Seed ->
(Int, Seed)<br>rollDie seed = ((seed `mod` 6) + 1, randomNext seed)<br><br>sumTwoDice :: Seed -> (Int, Seed)<br>sumTwoDice seed0 =<br> let (die1, seed1) = rollDie seed0<br> (die2, seed2) = rollDie seed1<br> in (die1 + die2, seed2)<br>
<br>(>>) m n = \seed0 -><br> let (result1, seed1) = m seed0<br> (result2, seed2) = n seed1<br> in (result2, seed2)<br><br>[michael@localhost ~]$ <br><br></td></tr></tbody></table><br>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br>