Re: Re[2]: [Haskell-cafe] type inference question

2009-10-08 Thread Lennart Augustsson
Indeed, the types foo :: forall a . (Num a) => a -> (Int, Float) and foo :: (forall a . (Num a) => a) -> (Int, Float) are quite different. The first one say, I (foo) can handle any kind of numeric 'a' you (the caller) can pick. You (the caller) get to choose exactly what type you give me. The

Re[2]: [Haskell-cafe] type inference question

2009-10-08 Thread Bulat Ziganshin
Hello Cristiano, Thursday, October 8, 2009, 7:14:20 PM, you wrote: > Could you explain why, under NoMonomorphismRestriction, this typechecks: > let a = 1 in (a + (1 :: Int),a + (1 :: Float)) > while this not: > foo :: Num a => a -> (Int,Float) > foo k = (k + (1 :: Int), k + (1.0 :: Float)) i