[GHC] #933: Separate compilation fails with existential records
GHC
trac at galois.com
Wed Oct 11 07:53:08 EDT 2006
#933: Separate compilation fails with existential records
-----------------------+----------------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.5
Severity: normal | Resolution:
Keywords: | Os: Unknown
Difficulty: Unknown | Architecture: Unknown
-----------------------+----------------------------------------------------
Old description:
> Consider M.hs:
>
> > {-# OPTIONS_GHC -fglasgow-exts #-}
> > module M where data D = forall a. C { l :: a }
>
> Then consider Main.hs:
>
> > import M
> > main = print () where x = C { l = () }
>
> A normal compilation works:
>
> $ ghc --make Main.hs
> [1 of 2] Compiling M ( M.hs, M.o )
> [2 of 2] Compiling Main ( Main.hs, Main.o )
> Linking Main ...
>
> However, separate compilation does not:
>
> $ touch Main.hs
> $ ghc --make Main.hs
> [2 of 2] Compiling Main ( Main.hs, Main.o )
>
> Main.hs:2:26:
> Constructor `C' does not have field `l'
> In the expression: C {l = ()}
> In the definition of `x': x = C {l = ()}
> In the definition of `main':
> main = print ()
> where
> x = C {l = ()}
>
> Where should I start looking to fix this? :-)
>
> Thanks,
> Audrey
New description:
Consider M.hs:
{{{
> {-# OPTIONS_GHC -fglasgow-exts #-}
> module M where data D = forall a. C { l :: a }
}}}
Then consider Main.hs:
{{{
> import M
> main = print () where x = C { l = () }
}}}
A normal compilation works:
{{{
$ ghc --make Main.hs
[1 of 2] Compiling M ( M.hs, M.o )
[2 of 2] Compiling Main ( Main.hs, Main.o )
Linking Main ...
}}}
However, separate compilation does not:
{{{
$ touch Main.hs
$ ghc --make Main.hs
[2 of 2] Compiling Main ( Main.hs, Main.o )
Main.hs:2:26:
Constructor `C' does not have field `l'
In the expression: C {l = ()}
In the definition of `x': x = C {l = ()}
In the definition of `main':
main = print ()
where
x = C {l = ()}
}}}
Where should I start looking to fix this? :-)
Thanks,
Audrey
Comment (by simonpj):
Audrey, when you added the "record fields in existentials" feature, you
didn't arrange that the info is recorded in interface files.
I discovered and fixed this when cleaning up IfaceSyn to add FC to GHC;
but the fix is only in the HEAD. The patch is not easy to incorporate in
the branch,
because the FC patch was very big.
Fixing the 6.6 branch is possible, but would mean a change in interface
file format, which we strongly discourage between patch-level releases.
So I'm inclined to leave it alone in the branch, and encourage you to try
the HEAD.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/933>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list