[nhc-bugs] Error: No match in _dropJust

Ralf Hinze ralf@informatik.uni-bonn.de
Wed, 31 Oct 2001 20:56:52 +0100


> Ralf,
>
> > When I compile frown with the brand-new 1.10 I get ...
> >
> > nhc98  -98  -ILib -PLib  -c -o GParser2.o GParser2.hs
> > /home/ralf/Lang//lib/nhc98/ix86-Linux/nhc98comp: Error: No match in
> > _dropJust
>
> It turns out that this is a long-standing bug in the type checker -
> it is not specific to version 1.10.  The problem is with higher kinds
> in type synonyms - nhc98 requires that synonyms be fully applied,
> even at the point of definition.  Specifically, if you change the line
>
>   type Result                   =  Lex Base.Result
>
> to
>
>   type Result a                 =  Lex Base.Result a
>
> then your example compiles just fine.  I'm afraid we are unlikely
> to have time to fix the many shortcomings of the type checker in the
> near future, so you will need to use this workaround.
>
> [ You may be interested to know that we tracked down this bug using Hat.
>   The function 'dropJust' is used in 96 different places in the
>   compiler, so it would otherwise be difficult to guess which use was
>   at fault.  By building the compiler itself with tracing switched on,
>   hat-stack was immediately able to identify a particular site in
>   TypeCtx.hs, and exploration with hat-trail showed that the list of
>   free type variables in the type synonym was empty where at least one
>   member was expected.
>
>   I think this is probably the largest program Hat has ever traced, at
>   29000 lines of code, generating a trace file of 750Mb.
> ]
>
> Regards,
>     Malcolm

Hi Malcolm,

thanks for tracing this down. Great, I am now able to compile Frown.

BTW, did you also look at the second bug ...

< Actually, I think there is another bug lurking around. I had to
< hide an identifier to get Grammar.lhs through (the original file
< called Grammar.lhs-orig is included). Let me know if you need
< further information.

1) Here is the story: we have a module `Haskell' that imports both
`Atom' and `Prettier' both of which define `string'.

> module Haskell                (  module Haskell, module Atom  )
> where
> import Atom                   hiding (  string  )
> import qualified Atom
> import Prettier

Now, does `Haskell' export the identifier `string'? GHC says no,
nhc98 says yes. Honestly, I don't know whether GHC or nhc98 is
wrong as I did not follow all the postings concerning the module system.

2) Furthermore, to get Frown compiled I had to change an import

import OrdUniqListSet         (  Set, MinView(..)  )

to

import OrdUniqListSet         (  Set, MinView(Empty, Min)  )

3) Finally, nhc98 does not like spurious commas in export lists.
GHC is non-Haskell 98 compliant here.

> module Case                  (  nexts, Branch(..), -- caseAnalysis, 
>                              ,  reportConflicts, BranchTable, branchLogic  )

Cheers, Ralf