Skip to content

Bogus type error message in type with constraints after the arrow

Hello,

I've found a bug, however it may be a duplicate of one of these: #2846 (closed), #3272 (closed), #3592 (closed), #3125 (closed), #3102 (closed) (roughly in order of duplicate-likelihoodness).

Here's the code:

type Foo a b = () -> (Bar a => a)

class Bar a where {}

foo :: Foo a b
foo = id (undefined :: Foo a b)

And the result of compilation:

$ ghc -fglasgow-exts --make Bug.hs

[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 6.10.4 for x86_64-unknown-linux):
  TcTyFuns.flattenType: unexpected PredType
  
  Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

I'm running Gentoo Linux, with dev-lang/ghc-6.10.4 (not dev-haskell/haskell-platform)

Linux geneva 2.6.29-gentoo-r5 #1 SMP Sun Jul 12 03:16:58 BST 2009 x86_64 Intel(R) Core(TM)2 CPU 4300 @ 1.80GHz GenuineIntel GNU/Linux

I'm afraid I've not tested this against HEAD, since I couldn't get it to build.

Note that foo = undefined :: Foo a b does not cause GHC to panic.

Trac metadata
Trac field Value
Version 6.10.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information