ghc抱怨“找不到模块'Monad'”

问题描述 投票:0回答:1

我一直很想和Haskell和Scheme一起玩,所以我决定通过《 48小时内编写自己的方案》一书来进行探索。

我刚碰到Monad模块似乎丢失的第一个障碍。我试过在ghci中运行它,结果似乎是相同的。

我的环境是OSX 10.15.2上的ghc 8.8.1。

% 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) *

这里是最小可复制文件:

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

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

这是编译错误:

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
  | ^^^^^^^^^^^^

有任何提示吗?

Alex

haskell
1个回答
0
投票

您是要导入Control.Monad吗?

不需要任何导入就可以编译程序,因为所需的一切已经通过Prelude模块隐式导入。

© www.soinside.com 2019 - 2024. All rights reserved.