gpt4 book ai didi

haskell - Data.Map 的合格导入与 Prelude 冲突

转载 作者:行者123 更新时间:2023-12-01 08:52:49 24 4
gpt4 key购买 nike

我想在我的代码中将 Prelude.mapData.Map.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’)

(我还拿了一个screenshot的错误信息,which you can see here。)

我希望能够分别使用 mapM.map;我该怎么做?

最佳答案

import Data.Map as M 从 Data.Map 中导入合格和不合格的名称。

要仅导入限定名称,请使用:

import qualified Data.Map as M

关于haskell - Data.Map 的合格导入与 Prelude 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37559009/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com