簡體   English   中英

ghc 抱怨“找不到模塊‘Monad’”

[英]ghc complains "Could not find module ‘Monad’"

我一直想嘗試使用 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
  | ^^^^^^^^^^^^

任何提示?

亞歷克斯

你的意思是導入 Control.Monad 嗎?

編譯縮小的程序不需要任何導入,因為您需要的一切都已經通過 Prelude 模塊隱式導入,但也許您的整個程序需要比 Prelude 更多的依賴項。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM