[Sorry for sending this message twice but I accidentally hit
the deliver button.]

Dear bug chasers,

ghc's latest version sometimes misses conflicting function definitions.
Consider the following *wrong* program:

%------------------------------------------------------------------------------

> module Small                  (  module Small  )
> where

> data MinView t a              =  Min a (t a)
>                               |  Infty

> newtype ToppedTree a          =  P (MinView BinTree a)
> data BinTree a                =  Bin a (BinTree a) (BinTree a)
>                               |  Empty

> P Infty         /\ u          =  P Infty
> t@(P (Min _ _)) /\ P Infty    =  P Infty
> P (Min a t)     /\ P (Min b u)
>     | a <= b                  =  P (Min a (Bin b u t))
>     | otherwise               =  P (Min b (Bin a t u))

> data Tree a                   =  Root a (Forest a)
>                               |  Void
> type Forest a                 =  [Tree a]

> Void          /\ u            =  Void
> t@(Root _ _)  /\ Void         =  Void
> t@(Root a ts) /\ u@(Root b us)
>     | a <= b                  =  Root a (u : ts)
>     | otherwise               =  Root b (t : us)

%------------------------------------------------------------------------------

Note that /\ is defined twice at different types. ghc replies

bind error in decl (2)
bind error in decl (2)
bind error in decl (2)
Module version unchanged at 3

Ralf

P.S.: Here is the verbose compiler output:

The Glorious Glasgow Haskell Compilation System, version 2.04, patchlevel 0

literate pre-processor:
        echo '#line 1 "Small.lhs"' > /tmp/ghc23960.lpp && 
/home/III/a/ralf/FP/ghc-2.04/lib/unlit  Small.lhs -  >> /tmp/ghc23960.lpp

real        0.0
user        0.0
sys         0.0

Effective command line: -i/home/III/a/ralf/TBoA/GHC/Import 
-L/home/III/a/ralf/TBoA/GHC/lib -lbn -v -c

Ineffective C pre-processor:
        echo '#line 1 "Small.lhs"' > /tmp/ghc23960.cpp && cat /tmp/ghc23960.lpp >> 
/tmp/ghc23960.cpp

real        0.0
user        0.0
sys         0.0

Haskell compiler:
        /home/III/a/ralf/FP/ghc-2.04/lib/hsc ,-W ,/tmp/ghc23960.cpp  
-fignore-interface-pragmas -fomit-interface-pragmas -fsimplify \(  
-ffloat-lets-exposing-whnf -ffloat-primops-ok -fcase-of-case -freuse-con 
-fpedantic-bottoms -fsimpl-uf-use-threshold3 -fmax-simplifier-iterations4 \)   
-himap=/home/III/a/ralf/TBoA/GHC/Import%.hi:.%.hi:/home/III/a/ralf/FP/ghc-2.04/lib/imports%.hi
   -v -hifile=/tmp/ghc23960.hi -S=/tmp/ghc23960.s +RTS -H6000000 -K1000000


================================================================================
Glasgow Haskell Compiler, version 2.03, for Haskell 1.4

bind error in decl (2)
bind error in decl (2)
bind error in decl (2)

real        2.3
user        1.9
sys         0.1

Pin on Haskell consistency info:
        echo '
        .text
hsc.Small.lhs.33.0..:' >> /tmp/ghc23960.s

real        0.0
user        0.0
sys         0.0
*** New hi file follows...
{-# GHC_PRAGMA INTERFACE VERSION 20 #-}
_interface_ Small
_instance_modules_
ArrBase IO PrelNum

_usages_
PrelBase 1 :: $d14 1 $d15 1 $d26 1 $d27 1 $d32 1 $d34 1 $d37 1 $d39 1 $d41 1 $d44 1 
$d45 1 $d46 1 $d49 1 $d51 1 $d6 1 $d7 1 otherwise 1 Eq 1 Eval 1 Ord 1 Ordering 1;
PrelNum 1 :: $d17 1 $d18 1;
_exports_
Small /\ BinTree(Bin Empty) Forest MinView(Min Infty) ToppedTree(P) Tree(Root Void);
_instances_
instance _forall_ [a] => {PrelBase.Eval (Tree a)} = $d1;
instance _forall_ [a] => {PrelBase.Eval (BinTree a)} = $d2;
instance _forall_ [a] => {PrelBase.Eval (ToppedTree a)} = $d3;
instance _forall_ [a :: (* -> *) b] => {PrelBase.Eval (MinView a b)} = $d4;
_declarations_
type Forest r3H = [Tree r3H] ;
data Tree r3J = Root r3J (Forest r3J) |  Void ;
data BinTree r3L = Bin r3L (BinTree r3L) (BinTree r3L) |  Empty ;
newtype ToppedTree r3N = P (MinView BinTree r3N) ;
data MinView r3P :: (* -> *) r3Q = Min r3Q (r3P r3Q) |  Infty ;
/\ _:_ _forall_ [a] {PrelBase.Ord a} => ToppedTree a -> ToppedTree a -> ToppedTree a ;;
$d1 _:_ _forall_ [a] => {PrelBase.Eval (Tree a)} ;;
$d2 _:_ _forall_ [a] => {PrelBase.Eval (BinTree a)} ;;
$d3 _:_ _forall_ [a] => {PrelBase.Eval (ToppedTree a)} ;;
$d4 _:_ _forall_ [a :: (* -> *) b] => {PrelBase.Eval (MinView a b)} ;;


Module version unchanged at 3

Replace .hi file, if changed:
        cmp -s Small.hi /tmp/ghc23960.hi-new || ( rm -f Small.hi && cp 
/tmp/ghc23960.hi-new Small.hi )

real        0.0
user        0.0
sys         0.0

Unix assembler:
        gcc -o Small.o -c  /tmp/ghc23960.s

real        0.2
user        0.0
sys         0.0

rm -f /tmp/ghc23960*

Reply via email to