Re: [Haskell-cafe] Type problems

2010-07-25 Thread Andrew Coppin
Ivan Miljenovic wrote: On 25 July 2010 05:50, Tobias Brandt tob.bra...@googlemail.com wrote: You have to fix the type of 1 and 6, e.g. by writing x - randomRIO (1, 6) :: IO Int or x - randomRIO (1, 6 :: Int) GHCi defaults integral numbers to Int, that's why it works there. The

Re: [Haskell-cafe] Type problems

2010-07-25 Thread Daniel Fischer
On Sunday 25 July 2010 14:12:03, Andrew Coppin wrote: Ivan Miljenovic wrote: On 25 July 2010 05:50, Tobias Brandt tob.bra...@googlemail.com wrote: You have to fix the type of 1 and 6, e.g. by writing x - randomRIO (1, 6) :: IO Int or x - randomRIO (1, 6 :: Int) GHCi defaults integral

Re: [Haskell-cafe] Type problems

2010-07-25 Thread Andrew Coppin
Daniel Fischer wrote: On Sunday 25 July 2010 14:12:03, Andrew Coppin wrote: Isn't there a default declaration where you can specify type defaulting? Yes, you can have one default declaration per module. Not a feature I ever use. I just vaguely remembered reading about it

Re: [Haskell-cafe] Type problems

2010-07-25 Thread Daniel Fischer
On Sunday 25 July 2010 14:47:41, Andrew Coppin wrote: Daniel Fischer wrote: On Sunday 25 July 2010 14:12:03, Andrew Coppin wrote: Isn't there a default declaration where you can specify type defaulting? Yes, you can have one default declaration per module. Not a feature I ever use. I

[Haskell-cafe] Type problems

2010-07-24 Thread michael rice
This works: Prelude System.Random do { randomRIO (1,6) = (\x - putStrLn $ Value = ++ show x) } Value = 5 So does this: Prelude System.Random do { x - randomRIO (1,6); putStrLn $ Value = ++ show x } Value = 2 But not this: 1 import Control.Monad 2 import System.Random 3 4 foo :: IO () 5

Re: [Haskell-cafe] Type problems

2010-07-24 Thread Tobias Brandt
You have to fix the type of 1 and 6, e.g. by writing x - randomRIO (1, 6) :: IO Int or x - randomRIO (1, 6 :: Int) GHCi defaults integral numbers to Int, that's why it works there. On 24 July 2010 21:36, michael rice nowg...@yahoo.com wrote: This works: Prelude System.Random do {

Re: [Haskell-cafe] Type problems

2010-07-24 Thread michael rice
Thanks, Tobias. I figured it was something like that but lack the syntax expertise on where to put it. MIchael --- On Sat, 7/24/10, Tobias Brandt tob.bra...@googlemail.com wrote: From: Tobias Brandt tob.bra...@googlemail.com Subject: Re: [Haskell-cafe] Type problems To: michael rice nowg

Re: [Haskell-cafe] Type problems

2010-07-24 Thread Daniel Fischer
On Saturday 24 July 2010 21:36:14, michael rice wrote: This works: Prelude System.Random do { randomRIO (1,6) = (\x - putStrLn $ Value = ++ show x) } Value = 5 So does this: Prelude System.Random do { x - randomRIO (1,6); putStrLn $ Value = ++ show x } Value = 2 But not this: 1

Re: [Haskell-cafe] Type problems

2010-07-24 Thread Ivan Miljenovic
On 25 July 2010 05:50, Tobias Brandt tob.bra...@googlemail.com wrote: You have to fix the type of 1 and 6, e.g. by writing x - randomRIO (1, 6) :: IO Int or x - randomRIO (1, 6 :: Int)  GHCi defaults integral numbers to Int, that's why it works there. The default numeric type is Integer,