我有以下代码:
{-# 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 中运行,则正常运行:
Ok, modules loaded: Simple.
*Simple> main
Application launched, listening on port 3000
但是如果运行它:
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 list
。