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!"
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'.
So I try ghc -package haskell98 Test.hs
:
Ambiguous module name `Prelude':
it was found in multiple packages: base haskell98-2.0.0.1
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'.
So then I try 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
How do I compile this code? I'm using GHC 7.4.1.
Import Data.Maybe
. The haskell98
package is no longer compatible with base
, so using the haskell98
modules brings just unnecessary pain.
The idea is that you use exactly one of haskell98
, base
, or haskell2010
. The haskell*
packages are the set of libraries mandated by the corresponding language standard, so if you use one of those you have a better chance of being compatible with non-GHC compilers. However, the vast majority of packages on Hackage use base
anyway, so you're probably better off sticking with that.
Haskell98 strictly speaking predates hierarchical modules, so that's why they are all called Maybe
and List
and IO
and so forth. (Actually, I think these are better names than what they are now, but that's another story). Your problem is that you were trying to use the old Maybe
and the new System.IO
at the same time, and neither the old nor the new package provides both.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With