2016-06-01 47 views
3

我想不同用途使用Prelude.mapData.Map.map在我的代碼衝突,但Data.Map一個合格的進口似乎並沒有幫助:Data.Map合格的進口與前奏

Prelude> import Data.Map as M 
Prelude M> map 

<interactive>:3:1: 
    Ambiguous occurrence ‘map’ 
    It could refer to either ‘M.map’ 
          imported from ‘Data.Map’ 
          (and originally defined in ‘containers-0.5.0.0:Data.Map.Base’) 
          or ‘Prelude.map’ 
          imported from ‘Prelude’ (and originally defined in ‘GHC.Base’) 

(我還採取了錯誤消息的screenshotwhich you can see here

我想能夠分別使用mapM.map。我怎樣才能做到這一點?

+0

你可能喜歡的[我的回答對明顯不相關的問題]開頭(http://stackoverflow.com/questions/8327032/write-this-scala - 矩陣乘法功能於哈斯克爾/ 8331995#8331995)。 –

回答

9

import Data.Map as M從Data.Map中導入名稱都是合格的和不合格的。

要只進口資質的名稱使用:

import qualified Data.Map as M