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
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
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
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
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
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 {
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
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
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,