extra "ambiguous type variable" errors after a "couldn't match" error?

7.8.3 has a new behaviour where a "plain" type error will cause "ambiguous type variable" errors, e.g.: module M where broken :: [Int] broken = () ambiguous :: a -> [String] ambiguous _ = map show [1..] When imported in ghci, I get: M.hs:4:10: Couldn't match expected type ‘[Int]’ with actual type ‘()’ In the expression: () In an equation for ‘broken’: broken = () M.hs:7:19: No instance for (Show a0) arising from a use of ‘show’ The type variable ‘a0’ is ambiguous [ ... and then more for Enum and Num ] It seems like the 'a' type variable causes this to happen. But I don't see why a type error in another place should cause 'ambiguous' to become ambiguous.

Good point! See https://ghc.haskell.org/trac/ghc/ticket/9323 Simon | -----Original Message----- | From: Glasgow-haskell-users [mailto:glasgow-haskell-users- | bounces@haskell.org] On Behalf Of Evan Laforge | Sent: 17 July 2014 02:32 | To: GHC users | Subject: extra "ambiguous type variable" errors after a "couldn't | match" error? | | 7.8.3 has a new behaviour where a "plain" type error will cause | "ambiguous type variable" errors, e.g.: | | module M where | | broken :: [Int] | broken = () | | ambiguous :: a -> [String] | ambiguous _ = map show [1..] | | When imported in ghci, I get: | | M.hs:4:10: | Couldn't match expected type ‘[Int]’ with actual type ‘()’ | In the expression: () | In an equation for ‘broken’: broken = () | | M.hs:7:19: | No instance for (Show a0) arising from a use of ‘show’ | The type variable ‘a0’ is ambiguous | [ ... and then more for Enum and Num ] | | It seems like the 'a' type variable causes this to happen. But I don't | see why a type error in another place should cause 'ambiguous' | to become ambiguous. | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On Thu, Jul 17, 2014 at 2:02 AM, Simon Peyton Jones
Good point! See https://ghc.haskell.org/trac/ghc/ticket/9323
Ah, fixed in the next release. Ok, that's good enough for me, it's only a minor annoyance.
participants (2)
-
Evan Laforge
-
Simon Peyton Jones