[Haskell-cafe] Re: Proposal: TypeDirectedNameResolution
Heinrich Apfelmus
apfelmus at quantentunnel.de
Fri Jul 31 06:00:59 EDT 2009
Ketil Malde wrote:
> Cale Gibbard writes:
>
>> There was a great related idea on #haskell the other day: Make
>> explicit qualification unnecessary whenever there is a *unique* choice
>> of module qualifications from those imported which would make the
>> expression typecheck.
>
> My favorite annoyance is repeated import lines for each library just
> to be able to use some unique identifiers unqualified, e.g.:
>
> import qualified Data.ByteString as B
> import Data.ByteString (ByteString)
> import qualified Data.Map as M
> import Data.Map (Map)
>
> and so on. I'm all for it, if for no other reason, then just to get
> rid of this.
Note that there are alternative solution for this particular problem.
For instance, a version of qualified with different semantics will do;
something like this
import Data.List
import sometimes qualified Data.Map as Map
foo :: Map k a -- accepted with out qualifier 'Map'
-- because it's unambiguous
bar m = map show m -- defaults to Data.List.map ,
-- 'Map' prefix would be need in
-- cases of ambiguity
The idea being that names only need to be qualified when they are
ambiguous, which Map and ByteString are not.
Regards,
apfelmus
--
http://apfelmus.nfshost.com
More information about the Haskell-Cafe
mailing list