I forgot the type signiture on the last last: (~>>) :: (Seed -> (a,Seed)) -> (Seed -> (b,Seed)) -> (Seed -> (b,Seed)) (~>>) m n = \seed0 -> let (result1, seed1) = m seed0 (result2, seed2) = n seed1 in (result2, seed2)
======== With it I get this: *Main> rollDie 362354 ~>> (rollDie ~>> rollDie) <interactive>:1:0: Couldn't match expected type `Seed -> (a, Seed)' 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> 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
