X-Comment1: #############################################################
X-Comment2: # uk.ac.glasgow.cs has changed to uk.ac.glasgow.dcs #
X-Comment3: # If this address does not work please ask your mail #
X-Comment4: # administrator to update your NRS & mailer tables. #
X-Comment5: #############################################################
Yes, it's Haskell-module time again. And it's that deamon Lennart too...
| I have a little problem in interpreting what an interface file means
| under peculiar circumstances (maybe I havn't read the report enough).
| Can the someone help me?
|
| The following interface file:
|
| interface B where
| import A(T(..)) renaming (T to S)
| data S = S Int
|
| is for a module
|
| module B(S(..)) where
| import A renaming(T to S)
|
| Question: What is the original declaration of type T?
| Both of the modules below could be right.
|
| module A where
| data T = S Int
|
| and
|
| module A where
| data T = T Int
|
| This happens because renaming happens in all namespaces, but there
| is no name clash between constructors and types.
Excellent question! (The Haskell module system is not marvellous, but
the renaming part of it is its worst feature. It *nearly* got changed
just before V1.1, but in the end the change got squished.)
Still in "fix things for SIGPLAN" mode, I suggest the following:
- the answer is that we assume everything is renamed
(ie the second of the two alternatives is right)
- if you don't want that, you should write
interface B
import A(T(S)) renaming (T to S)
data S = S Int
The question is: what to say in the report? I'm strongly inclined to say
nothing, naughty though that is. The only alternative seems to be to give
Lennart's example in Section 5.3.2. Advice anyone?
Simon "I just love these warts" PJ