Inferred types problem
I've talked about this issue on Haskell irc and nobody knows why types are not automatically inferred in this example.
Lets consider following code:
data X a = X { method1 :: a } deriving(Show)
cons_X = X { method1 = (\a b -> (a,b)) }
f x = method1 x :: a -> b -> (a, b)
main = do
let x = cons_X
let a = f x
return ()
It works if we do not write the explicit type signature. What is interesting, If we write it wrong, like
f x = method1 x :: Int
compiler tells us:
Couldn't match type `t0 -> t1 -> (t0, t1)' with `Int'
It does not work if we even specify explicit f type:
f :: X (a -> b -> (a, b)) -> (a -> b -> (a, b))
Trac metadata
Trac field | Value |
---|---|
Version | 7.6.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |