[GHC] #3877: XOverlappingInstances flag not working

GHC trac at galois.com
Thu Feb 11 20:24:39 EST 2010


#3877: XOverlappingInstances flag not working
-------------------------------+--------------------------------------------
    Reporter:  traz161616      |       Owner:                           
        Type:  bug             |      Status:  new                      
    Priority:  normal          |   Component:  Compiler (Type checker)  
     Version:  6.12.1          |    Keywords:  XOverlappingInstances    
          Os:  Linux           |    Testcase:                           
Architecture:  x86_64 (amd64)  |     Failure:  GHC rejects valid program
-------------------------------+--------------------------------------------
 I tried compiling the attached snippet with both ghc 6.12.1 and 6.10.4.
 The result is that even with XOverlappingInstances flag it still does not
 allow the program although it is provided with a concrete instance.

 The code snippet is:
 {- File overlap.hs -}
 {-# OPTIONS_GHC -XOverlappingInstances -XTypeSynonymInstances #-}

 type PairIS = (Int,String)
 instance Show PairIS where
  show (a,b) = "(("++(show a)++","++(show b)++"))"

 test :: Int -> String -> String
 test a b = show (a,b)


 The OS is :Linux 2.6.31-19-server #56-Ubuntu SMP x86_64
 The gcc version is (irrelevant): gcc version 4.4.1

 The error message is:

 Glasgow Haskell Compiler, Version 6.12.1, for Haskell 98, stage 2 booted
 by GHC version 6.8.2
 Using binary package database:
 /usr/local/lib/ghc-6.12.1/package.conf.d/package.cache
 wired-in package ghc-prim mapped to ghc-
 prim-0.2.0.0-9d35c97e886f807a1e6d024aaa91dcec
 wired-in package integer-gmp mapped to integer-
 gmp-0.2.0.0-9a51ffb34a83618a1a3d4e472b9977a0
 wired-in package base mapped to
 base-4.2.0.0-b340bbd470b5859bcbb920aea62a12cf
 wired-in package rts mapped to builtin_rts
 wired-in package haskell98 mapped to
 haskell98-1.0.1.1-0fdaf3b26bc38c43ce8371edf538dbf6
 wired-in package template-haskell mapped to template-
 haskell-2.4.0.0-fc13d9708caa0cfdc4173ee31dc2bf26
 wired-in package dph-seq mapped to dph-
 seq-0.4.0-b8a71915f9569cbd3a6895da8311707a
 wired-in package dph-par mapped to dph-
 par-0.4.0-68df56bb8ae18f20e3518a7b338d7ebc
 Hsc static flags: -static


 D:\code\overlap.hs:8:11:
     Overlapping instances for Show (Int, String)
       arising from a use of `show' at D:\code\overlap.hs:8:11-20
     Matching instances:
       instance (Show a, Show b) => Show (a, b) -- Defined in GHC.Show
       instance [overlap ok] Show PairIS
         -- Defined at D:\code\overlap.hs:4:9-19
     In the expression: show (a, b)
     In the definition of `test': test a b = show (a, b)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3877>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list