"Num a => a", which I understand
to mean "an arbitrary numeric type", why is it OK to pass 2 to a
function that expects an Int?
Thank you.
Robert Stroud
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell
Dear Arie,
Thank you for your answers to my questions - I'd spotted the section
on ambiguous types and defaults in the language manual, but I hadn't
appreciated that it might be applicable in this situation because I
didn't know that show and read could be applied to (almost) all types.
H
On 21 Sep 2006, at 08:07, David House wrote:
On 20/09/06, Bulat Ziganshin <[EMAIL PROTECTED]> wrote:
i definitely think that to rise up Haskell popularity we need now to
create web forum.
I happen to think this would be a good idea from a newbie's point of
view. For one-off questions (or per
nstant. The
second reason is to prevent ambiguity, but the example involves a non-
simple binding. So why is it necessary to give a named constant a
monomorphic type, when the unnamed constant has a polymorphic type?
Thanks,
Robert
On 20 Sep 2006, at 18:37, Christian Sievers wrote:
Robe
On 20 Sep 2006, at 17:28, Christian Sievers wrote:
However, if I type an apparently equivalent let expression into Hugs
directly, then I get the value 4 as expected
let k = 2 ; f :: Int -> Int -> Int ; f x y = x * y in f k k
Why is there a difference in behaviour?
Here, there is no defaulti
On 21 Sep 2006, at 10:46, Robert Stroud wrote:
So k gets a monotype which is determined by its usage, you cannot
do e.g.
let k = 2 ; f :: Int -> Int -> Int ; f x y = x * y in (f k k, 1/k)
whereas let k :: Num a => a; k = 2; ... is possible.
Thanks - that's a helpfu
On 20 Sep 2006, at 22:21, Ashley Yakeley wrote:Arie Peterson wrote: You absolutely right about this defaulting breaking referential transparency. Do you know if it can be switched off in GHC? I know one can switch on warnings when it happens, but I don't think that's the same thing.You can use an e