简体   繁体   中英

ghc complains "Could not find module ‘Monad’"

I've long wanted to have a play with Haskell and Scheme so I decided to work through the book "Write yourself a Scheme in 48 Hours" to explore both.

I just hit my first obstacle where the Monad module seems to be missing. I've tried running it in ghci and the result seems to be the same.

My environment is ghc 8.8.1 on OSX 10.15.2.

% brew info ghc ghc: stable 8.8.1 (bottled), HEAD Glorious Glasgow
Haskell Compilation System https://haskell.org/ghc/
/usr/local/Cellar/ghc/8.8.1 (6,813 files, 1.5GB) *

Here is the minimum reproducible file:

% cat hello.hs
module Main where
import Monad
import System.Environment

main :: IO ()
main = do
  putStrLn ("Hello")

And here is the compilation error:

ghc hello.hs
[1 of 1] Compiling Main             ( hello.hs, hello.o )

hello.hs:2:1: error:
    Could not find module ‘Monad’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
2 | import Monad
  | ^^^^^^^^^^^^

Any hints?

Alex

Did you mean to import Control.Monad?

None of the imports you have are needed to compile the minified program, since everything you need is already implicitly imported through the Prelude module, but maybe your whole program requires more dependencies than Prelude.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM