I'm just copying code from this web page: http://en.wikibooks.org/wiki/Haskell/Understanding_monads
================ Using their initial seed I get this: *Main> rollDie 362354 ~>> (rollDie ~>> rollDie) <interactive>:1:0: Couldn't match expected type `t -> (t1, t2)' against inferred type `(Int, Seed)' In the first argument of `(~>>)', namely `rollDie 362354' In the expression: rollDie 362354 ~>> (rollDie ~>> rollDie) In the definition of `it': it = rollDie 362354 ~>> (rollDie ~>> rollDie) *Main> =================== Passing their initial seed through successive calls to rollDie: *Main> rollDie 362354 Loading package old-locale-1.0.0.1 ... linking ... done. Loading package old-time-1.0.0.1 ... linking ... done. Loading package random-1.0.0.1 ... linking ... done. (3,1795116384) *Main> rollDie 1795116384 (1,523309185) *Main> rollDie 523309185 (4,1311937830) <== ISN'T THIS SUPPOSED TO BE THE RESULT? *Main> Michael --- On Wed, 4/22/09, Achim Schneider <[email protected]> wrote: From: Achim Schneider <[email protected]> Subject: [Haskell-cafe] Re: Overriding a Prelude function? To: [email protected] Date: Wednesday, April 22, 2009, 9:52 PM michael rice <[email protected]> wrote: > OK, I changed the operator from (>>) to (~>>). When I try to use it I > get this: > > [mich...@localhost ~]$ ghci rand > GHCi, version 6.10.1: http://www.haskell.org/ghc/__ :? for help > Loading package ghc-prim ... linking ... done. > Loading package integer ... linking ... done. > Loading package base ... linking ... done. > [1 of 1] Compiling Main________________________ ( rand.hs, interpreted ) > Ok, modules loaded: Main. > *Main> rollDie ~>> (rollDie ~>> rollDie) > > <interactive>:1:0: > ______ No instance for (Show (Seed -> (Int, Seed))) > __________ arising from a use of `print' at <interactive>:1:0-32 > ______ Possible fix: > __________ add an instance declaration for (Show (Seed -> (Int, Seed))) > ______ In a stmt of a 'do' expression: print it Well, you obviously need an initial seed: rollDie 0xdeadbeef ~>> (rollDie ~>> rollDie) -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited. _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
