Bug in GHC when compiling with -O ?

Klaus Lüttich luettich at tzi.de
Tue Aug 17 09:39:16 EDT 2004


we are working on a very large project called Hets (heterogenous tool
set) where we encounterd two related errors in ghc, which disappear when
we start over the compilation at that point where the compilation
due to one of that errors. We certainly use the current version 6.2.1 of

We use in conjunction these command line switches for the compilation:
  --make -fglasgow-exts -fallow-overlapping-instances
  -fallow-undecidable-instances -O

where actually only some imported packages really need these switches:
-fallow-overlapping-instances -fallow-undecidable-instances 

The tar-ball with the error enabled in the toplevel Makefile is
available here: 

The errors also disappear when we compile the problematic modules


The error messages we get when compiling:

Compiling Common.Lib.Rel   ( ./Common/Lib/Rel.hs, ./Common/Lib/Rel.o )

    Could not unambiguously deduce (Show (a, a))
	from the context (Show (Rel a), Show a, Ord a)
      arising from use of `show' at ./Common/Lib/Rel.hs:102
    The choice of (overlapping) instance declaration
	depends on the instantiation of `a'
    Probable fix:
	Add (Show (a, a)) to the class or instance method `show'
	Or add an instance declaration for (Show (a, a))
    In the first argument of `(.)', namely `show'
    In the definition of `show':
	show = show . (Common.Lib.Set.fromList . toList)
    In the definition for method `show'

Compiling Common.PPUtils   ( ./Common/PPUtils.hs, ./Common/PPUtils.o )

    Could not unambiguously deduce (Show (a, b))
        from the context (PrettyPrint a, PrettyPrint b)
      arising from the instance declaration at ./Common/PPUtils.hs:176
    The choice of (overlapping) instance declaration
        depends on the instantiation of `a, b'
    Probable fix:
        Add (Show (a, b)) to the instance declaration superclass context
        Or add an instance declaration for (Show (a, b))
    In the instance declaration for `PrettyPrint (a, b)'

Klaus Lüttich    Email:   luettich at tzi.de
FB 3             Phone:   +49-421-218-7129
Uni Bremen

More information about the Glasgow-haskell-users mailing list