I've had a problem using GHC exporting the constuctor (:::).

Here is a cut down version that causes the problem.

----------8<------------

module MyList (MyList(Empty, (:::))) where

data MyList a =   Empty
                | (MyList a) ::: (MyList a)

----------8<------------

module User where

import MyList

myLength :: MyList a -> Int
myLength Empty = 0
myLength (x ::: xs) = 1 + myLength xs

----------8<------------

When I compile with ghc 2.09:

{kurango}ghcbug>73> ghc -c MyList.hs
ghc: module version changed to 1; reason: no old .hi file
{kurango}ghcbug>74> ghc -c User.hs
 
User.hs:3: Interface-file parse error: line 7 toks= []
 
User.hs:3: Could not find valid interface file `MyList'

Compilation had errors

The problem seems to be :::.

----------8<------------

module MyList2 (MyList(Empty, (:#:))) where

data MyList a =   Empty
                | (MyList a) :#: (MyList a)

----------8<------------

module User2 where

import MyList2

myLength :: MyList a -> Int
myLength Empty = 0
myLength (x :#: xs) = 1 + myLength xs

----------8<------------

{kurango}ghcbug>82> ghc -c MyList2.hs
ghc: module version changed to 1; reason: no old .hi file
{kurango}ghcbug>83> ghc -c User2.hs
ghc: module version changed to 1; reason: no old .hi file
{kurango}ghcbug>84> 

As far as I can tell ::: is a permitted name for a constructor. Hugs
and GHC love it. The code reading the interface files doesn't
like it much though.

Cheers,
Rock.
--
Andrew Rock -- [EMAIL PROTECTED] -- http://www.cit.gu.edu.au/~arock/
School of Computing and Information Technology
Griffith University -- Nathan, Brisbane, Queensland 4111, Australia

Reply via email to