gpt4 book ai didi

haskell - GHC 包冲突

转载 作者:行者123 更新时间:2023-12-03 15:05:52 24 4
gpt4 key购买 nike

我正在尝试使用 GHC 编译以下代码:

module Test where

import Maybe
import Prelude hiding (null)
import System.IO

null = ()

main :: IO ()
main = putStrLn "Hello, world!"

如果我只是运行 ghc Test.hs ,我得到:
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 :
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。

最佳答案

进口 Data.Maybe . haskell98包不再兼容 base ,所以使用 haskell98模块只会带来不必要的痛苦。

关于haskell - GHC 包冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10474413/

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