Trex and module system

Ross Paterson ross@soi.city.ac.uk
Tue, 18 Feb 2003 20:12:55 +0000


On Tue, Feb 18, 2003 at 11:51:06AM -0800, Iavor S. Diatchki wrote:
> the recent updates of the module system seem to have broken Trex.
> the problem is that Hugs.Trex tries to export "EmptyRec" which is a data 
> constructor and so cannot be named explicitly in an export list.
> (interestingly enough the Prelude does the same, but no error seems to 
> occur)

There's an ugly hack for the prelude, so (:) and EmptyRec can escape.
(Another consequence: if you import Prelude(), you don't even have (:)).

> a quick fix that seems to work is to change the Hugs.Trex module as follows:
> 
> module Hugs.Trex( module Hugs.Trex ) where
> 
> import Hugs.Prelude as Hugs.Trex -- ( Rec, EmptyRec, EmptyRow )
> 
> of course now Trex exports the whole of the Prelude, but hey it is a 
> quick fix :-)

I think the problem is that EmptyRec isn't a real constructor (it has
type Rec EmptyRow, not Rec r), and the fix should be to add

	emptyRec = EmptyRec

and export that instead of EmptyRec (and maybe change the Show instance
to match).