[Haskell-cafe] Problem with Data.Map
nowgate at yahoo.com
Mon Jun 8 13:17:41 EDT 2009
Sounds like Lisp packages. Now I see the functionality of the A or B, etc.: Fewer keystrokes.
--- On Mon, 6/8/09, minh thu <noteed at gmail.com> wrote:
From: minh thu <noteed at gmail.com>
Subject: Re: [Haskell-cafe] Problem with Data.Map
To: "michael rice" <nowgate at yahoo.com>
Cc: "Jochem Berndsen" <jochem at functor.nl>, haskell-cafe at haskell.org
Date: Monday, June 8, 2009, 1:00 PM
> import Blurp
bring every thing defined in the Blurp module in scope.
So if blah is defined in blurp,
will work as expected.
> import qualified Blurp as B
does the same thing but everything defined in Blurp should be
qualified (i.e. prefixed) with B.
will work, not
So your import statement is right but you should write Map.fromList
instead of just fromList.
The goal is to have multiple identical names from different modules
and still be able to use them at the same time, but qualified, for
instance lookup is defined in both Data.List and Data.Map.
> import qualified Data.List as L
> import qualified Data.Map as M
The two last lines are unambiguous.
2009/6/8 michael rice <nowgate at yahoo.com>:
> I don't understand your response. I copied the imports from Hoogles Data.Map
> page. What should the imports be?
> --- On Mon, 6/8/09, Jochem Berndsen <jochem at functor.nl> wrote:
> From: Jochem Berndsen <jochem at functor.nl>
> Subject: Re: [Haskell-cafe] Problem with Data.Map
> To: "michael rice" <nowgate at yahoo.com>
> Cc: haskell-cafe at haskell.org
> Date: Monday, June 8, 2009, 12:45 PM
> michael rice wrote:
>> I'm trying to understand Map type for possible use in another problem I'm
>> working on, but am stymied right off the bat.
>> ==========Here's my source:
>> import Data.Map (Map)
>> import qualified Data.Map as Map
>> *Main> fromList $ zip l1 l2
>> <interactive>:1:0: Not in scope: `fromList'
> You imported map "qualified as Map", that means that only 'Map.fromList'
> and 'Data.Map.fromList' are in scope, and not 'fromList'. The reason one
> normally does it like this is that a lot of function names clash with
> the Prelude (on purpose). Normally one uses "qualified as M" or
> "qualified as Map" to shorten the notation.
> Jochem Berndsen | jochem at functor.nl
> GPG: 0xE6FABFAB
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe