Skip to content

Parsing type constraints in GHC 7.4.1

This appears to be a parsing bug, or at least a bad error message, for a *malformed* type constraint:

Given the following malformed program, I get the following output loading it with ghci (GHC 7.4.1):


module Test where

data Foo a = Foo a

-- Malformed!
instance Ord a => Eq a => Show (Foo a) where
  show (Foo a) = undefined

$ ghci Test.hs 
GHCi, version 7.4.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Test             ( Test.hs, interpreted )
*** Exception: compiler/rename/RnSource.lhs:429:14-81: Irrefutable pattern failed for pattern Data.Maybe.Just (inst_tyvars,
                                                        _,
                                                        SrcLoc.L _ cls,
                                                        _)

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