Marcin 'Qrczak' Kowalczyk wrote:
> Shouldn't foreign exported names be allowed to be qualified?
IMHO not:
module Foo where
Foo.f = "This is not allowed, either."
> I've just accidentally reused a Prelude name for a function to be
> foreign exported and could not resolve the conflict with the first
> way that came to mind: qualifying.
You can use `hiding' + qualifying instead:
module Foo where
import Prelude hiding(elem)
foreign export elem :: Int -> IO ()
elem = print
isVowel :: Char -> Bool
isVowel = (`Prelude.elem` "aeiouAEIOU")
BTW, with -Wall ghc gives a false alarm:
Foo.hs:1: Warning: definition but no type signature for `elem'
> BTW. The fact that functions containing the letter z in their names
> will get zz in C names, unless explicitly specified differently,
> should be either changed or documented.
There is discrepancy between the names allowed for _ccall_{,GC_} and
the foreign family. In the former case varids *and* conids are allowed,
in the latter only varids. My suggestion: Allow both kinds of names
for foreign, too, and do no mangling at all. This change and the
comment should make their way into the FFI doc.
Comments/opinions?
Cheers,
Sven
--
Sven Panne Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen Oettingenstr. 67
mailto:[EMAIL PROTECTED] D-80538 Muenchen
http://www.informatik.uni-muenchen.de/~Sven.Panne