找不到模块“是" [英] Could not find module `Yesod'

查看:64
本文介绍了找不到模块“是"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses,
             TemplateHaskell, OverloadedStrings #-}

module Simple where
import Yesod
data HelloWorld = HelloWorld

mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET
|]

instance Yesod HelloWorld

getHomeR = defaultLayout [whamlet|Hello World!|]

withHelloWorld  f = toWaiApp HelloWorld >>= f

main = warpDebug 3000 HelloWorld

如果在GHCI中运行,它将正常运行:

If run it in GHCI, it runs normally:

Ok, modules loaded: Simple.
*Simple> main
Application launched, listening on port 3000

但是如果以以下方式运行它:

But if run it as:

wai-handler-devel 3000 Simple withHelloWorld

控制台报告错误:

pshuvaev@pshuvaev-K73SV:~/works/haskell/yesod/SimpleSite$ wai-handler-devel 3000 Simple.hs withHelloWorld
Attempting to interpret your app...
Compile failed: 

Could not find module `Yesod'
Use -v to see a list of the files searched for.

可能是什么问题?Yesod已设置,并显示在 ghc-pkg列表的输出中.

What could be the problem? Yesod is set and it displays in the output of ghc-pkg list.

推荐答案

在Unix系统上,删除〜/.ghc 目录并运行:

On Unix systems remove ~/.ghc directory and run:

ghc-pkg --global recache

在Windows系统上(只是建议),删除 C:\ Users \ USERNAME \ AppData \ Roaming \ ghc ,然后从命令行(以Admin)重新缓存:

On Windows systems (just suggestion) remove C:\Users\USERNAME\AppData\Roaming\ghc and also recache from the command line (as Admin):

ghc-pkg --global recache

不确定Windows!请检查!

这篇关于找不到模块“是"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆