<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><a rel="nofollow" target="_blank" href="http://en.wikibooks.org/wiki/Haskell/Understanding_monads"><span class="yshortcuts" id="lw_1240456330_5">I'm just copying code from this web page: http://en.wikibooks.org/wiki/Haskell/Understanding_monads</span></a><br><br>================<br><br>Using their initial seed I get this:<br><br>*Main> rollDie 362354 ~>> (rollDie ~>> rollDie)<br><br><interactive>:1:0:<br> Couldn't match expected type `t -> (t1, t2)'<br> against inferred type `(Int, Seed)'<br> In the first argument of `(~>>)', namely `rollDie 362354'<br> In the expression: rollDie 362354 ~>> (rollDie ~>> rollDie)<br> In the definition of `it':<br> it
= rollDie 362354 ~>> (rollDie ~>> rollDie)<br>*Main> <br><br>===================<br><br>Passing their initial seed through successive calls to rollDie:<br><br>*Main> rollDie 362354<br>Loading package old-locale-1.0.0.1 ... linking ... done.<br>Loading package old-time-1.0.0.1 ... linking ... done.<br>Loading package random-1.0.0.1 ... linking ... done.<br>(3,1795116384)<br>*Main> rollDie 1795116384<br>(1,523309185)<br>*Main> rollDie 523309185<br>(4,1311937830) <== ISN'T THIS SUPPOSED TO BE THE RESULT?<br>*Main> <br><br>Michael<br><br><br>--- On <b>Wed, 4/22/09, Achim Schneider <i><barsoap@web.de></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Achim Schneider <barsoap@web.de><br>Subject: [Haskell-cafe] Re: Overriding a Prelude function?<br>To: haskell-cafe@haskell.org<br>Date: Wednesday, April 22, 2009, 9:52 PM<br><br><div
class="plainMail">michael rice <<a ymailto="mailto:nowgate@yahoo.com" href="/mc/compose?to=nowgate@yahoo.com">nowgate@yahoo.com</a>> wrote:<br><br>> OK, I changed the operator from (>>) to (~>>). When I try to use it I<br>> get this:<br>> <br>> [michael@localhost ~]$ ghci rand<br>> GHCi, version 6.10.1: <a href="http://www.haskell.org/ghc/__" target="_blank">http://www.haskell.org/ghc/__</a> :? for help<br>> Loading package ghc-prim ... linking ... done.<br>> Loading package integer ... linking ... done.<br>> Loading package base ... linking ... done.<br>> [1 of 1] Compiling Main________________________ ( rand.hs, interpreted )<br>> Ok, modules loaded: Main.<br>> *Main> rollDie ~>> (rollDie ~>> rollDie) <br>> <br>> <interactive>:1:0:<br>> ______ No instance for (Show (Seed -> (Int, Seed)))<br>> __________ arising from a use of `print' at
<interactive>:1:0-32<br>> ______ Possible fix:<br>> __________ add an instance declaration for (Show (Seed -> (Int, Seed)))<br>> ______ In a stmt of a 'do' expression: print it<br><br>Well, you obviously need an initial seed:<br><br>rollDie 0xdeadbeef ~>> (rollDie ~>> rollDie)<br><br>-- <br>(c) this sig last receiving data processing entity. Inspect headers<br>for copyright history. All rights reserved. Copying, hiring, renting,<br>performance and/or quoting of this signature prohibited.<br><br><br>_______________________________________________<br>Haskell-Cafe mailing list<br><a ymailto="mailto:Haskell-Cafe@haskell.org" href="/mc/compose?to=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></div></blockquote></td></tr></table><br>