[Haskell-cafe] type inference question
Bulat Ziganshin
bulat.ziganshin at gmail.com
Thu Oct 8 11:35:47 EDT 2009
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 think it's because type is different:
foo :: (forall a. (Num a) => a) -> (Int,Float)
in first equation it probably inferred correctly
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe
mailing list