Incorrect location of variables in pattern bindings
If we write
f :: a -> b
(f) = \x -> (x :: a)
(NB: a pattern binding) we see that GHC reports the location of a
as being bound on the line defining f
, not its signature:
/Users/rae/temp/Bug2.hs:2:14: error:
• Couldn't match expected type ‘a1’ with actual type ‘a’
‘a1’ is a rigid type variable bound by
an expression type signature:
forall a1. a1
at /Users/rae/temp/Bug2.hs:2:19
‘a’ is a rigid type variable bound by
the inferred type of f :: a -> b
at /Users/rae/temp/Bug2.hs:2:1-20
• In the expression: x :: a
In the expression: \ x -> (x :: a)
In a pattern binding: (f) = \ x -> (x :: a)
• Relevant bindings include
x :: a (bound at /Users/rae/temp/Bug2.hs:2:8)
f :: a -> b (bound at /Users/rae/temp/Bug2.hs:2:2)
|
2 | (f) = \x -> (x :: a)
| ^
The key bit is the binding for the variable a
in this message, on line 2. It should be line 1.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information