ghc-3.02-i386-unknown-bin...  taken from  
                                      dcs.gla.ac.uk..../glasgow/3.02
runs into a bug (?) when compiling the program


--------------------------------------------------------------------
module T where

type Cp a =  a -> a -> Ordering

m :: Eq a => Cp a -> [a] -> a
m            _       [x,y,z] =  if x==y then x else z  
     
cpPairs :: Cp [j] -> (a,[j]) -> (a,[j]) -> Ordering
cpPairs    cp        (_,p)      (_,q)   =  cp p q

mp :: (Eq i,Eq j) => Cp [j] -> [(i,[j])] -> (i,[j])
mp                   cp        dD          =  
                                    let  minInRow = m (cpPairs cp)
                                    in   minInRow dD
  
                                             -- m (cpPairs cp) dD
------------------------------------------------------------------



                  ghc -c -v T.hs
gives

The Glorious Glasgow Haskell Compilation System, version 3.02, 
  patchlevel 0
Effective command line: -c -v
Ineffective C pre-processor:
 echo '{-# LINE 1 "T.hs" -}' > /tmp/ghc582.cpp && cat T.hs >>
                                                    /tmp/ghc582.cpp
real    0m0.001s
user    0m0.000s
sys     0m0.000s
ghc:recompile:Input file T.hs newer than T.o

Haskell compiler:
        /usr/ghc/3.02/lib/ghc-3.02/hsc ,-W ,/tmp/ghc582.cpp  
-fignore-interface-pragmas -fomit-interface-pragmas -fsimplify 
[  -ffloat-lets-exposing-whnf -ffloat-primops-ok -fcase-of-case 
-fdo-case-elim -freuse-con -fpedantic-bottoms -fmax-simplifier-iterations4  ]
 -fwarn-overlapping-patterns -fwarn-missing-methods -fwarn-duplicate-exports 
-himap=.%.hi:/usr/ghc/3.02/lib/ghc-3.02/imports/std%.hi   -v 
-hifile=/tmp/ghc582.hi -C=/tmp/ghc582.hc +RTS -H6000000 -K1000000
Glasgow Haskell Compiler, version 3.02, for Haskell 1.4
 
T.hs:24:
    Ambiguous type variable(s)
    `j' in the constraint `Eq (aYD, [j])'
        arising from use of `m' at T.hs:24
    In an equation for function `mp':
        mp cp dD = let minInRow = m (cpPairs cp) in minInRow dD
T.hs:24:
    Ambiguous type variable(s)
    `j' in the constraint `Eq (aYD, [j])'
        arising from use of `m' at T.hs:24
    In an equation for function `mp':
        mp cp dD = let minInRow = m (cpPairs cp) in minInRow dD

Compilation had errors
real    0m1.550s
user    0m1.480s
sys     0m0.070s
deleting... /tmp/ghc582.cpp /tmp/ghc582.hi /tmp/ghc582.hc
rm -f /tmp/ghc582*
------------------------------------------------------------------



A slight change   mp ... =  m (cpPairs cp) dD   improves it.

Also, very probably,  ghc-3.01  is free of this bug.

Sadly, i cannot guess so far what to change in my real program,
because there the things are more complex.
Please, advise.


------------------
Sergey Mechveliani
[EMAIL PROTECTED]







Reply via email to