Confusing type error behaviour
|Reported by:||simonpj||Owned by:|
|Component:||Compiler (Type checker)||Version:||7.8.3|
|Type of failure:||None/Unknown||Test Case:||typecheck/should_fail/T9323.hs|
|Related Tickets:||Differential Revisions:|
Description (last modified by simonpj)
Compile this example with GHC 7.8.3.
module Foo where broken :: [Int] broken = () ambiguous :: a -> String ambiguous _ = show 0
Foo.hs:4:10: Couldn't match expected type ‘[Int]’ with actual type ‘()’ In the expression: () In an equation for ‘broken’: broken = () Foo.hs:7:15: No instance for (Show a0) arising from a use of ‘show’ The type variable ‘a0’ is ambiguous
(and a similar ambiguous (Num a0) error).
But if you comment out broken, the program compiles, using the defaulting rules to choose a0 = Integer.
This is obviously wrong.
Reported by Evan Laforge.
Change History (3)
comment:1 Changed 12 months ago by simonpj
- Description modified (diff)
- Version changed from 7.8.2 to 7.8.3