[nhc-bugs] Error: No match in _dropJust

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Wed, 31 Oct 2001 11:47:07 +0000


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