names, modules, types
Johannes Waldmann
joe@isun.informatik.uni-leipzig.de
Wed, 7 Feb 2001 10:08:14 +0100 (MET)
> import Handle as H
>
> H.getLine
>
> (This is a good example where type classes would not help
> making this any better, since the types of getLine and
> H.getLine are very different.)
not too different, I think; static overloading would help.
Just allow to have two (or more) identifiers with the same name,
but different types.
getLine :: IO String; getLine :: Handle -> IO String
At each usage of getLine, the typechecker should follow both tracks,
and take the one that is type-correct.
There should be exactly one; and the programmer can achieve this
by adding an explicit signature. (*)
This would also allow algebraic data types to share field labels,
without any changes to record syntax and semantics (I hope).
(*) there is a problem if you have a class method (like `map' in Functor)
and a function (like `map' for lists) of the same name,
and an instance Functor []. This is really only a problem
if all of these declarations are visible at once.
But then, this can be fixed using qualified imports.
Best regards,
--
-- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ --
-- joe@informatik.uni-leipzig.de -- phone/fax (+49) 341 9732 204/252 --