GHC 包冲突 [英] GHC package conflicts
本文介绍了GHC 包冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 GHC 编译以下代码:
I'm trying to compile the following code with GHC:
module Test where
import Maybe
import Prelude hiding (null)
import System.IO
null = ()
main :: IO ()
main = putStrLn "Hello, world!"
如果我只运行 ghc Test.hs
,我得到:
If I just run ghc Test.hs
, I get:
Could not find module `Maybe'
It is a member of the hidden package `haskell98-2.0.0.1'.
所以我尝试 ghc -package haskell98 Test.hs
:
Ambiguous module name `Prelude':
it was found in multiple packages: base haskell98-2.0.0.1
好像不对,不过我试试ghc -package haskell98 -hide-package base Test.hs
:
It doesn't seem right, but I try ghc -package haskell98 -hide-package base Test.hs
:
Could not find module `System.IO'
It is a member of the hidden package `base'.
It is a member of the hidden package `haskell2010-1.1.0.1'.
然后我尝试 ghc -package haskell98 -hide-package base -package haskell2010 Test.hs
:
Ambiguous module name `Prelude':
it was found in multiple packages:
haskell2010-1.1.0.1 haskell98-2.0.0.1
我如何编译这段代码?我使用的是 GHC 7.4.1.
How do I compile this code? I'm using GHC 7.4.1.
推荐答案
导入 Data.Maybe
.haskell98
包不再与 base
兼容,因此使用 haskell98
模块只会带来不必要的痛苦.
Import Data.Maybe
. The haskell98
package is no longer compatible with base
, so using the haskell98
modules brings just unnecessary pain.
这篇关于GHC 包冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文