3

私は次のコードを持っています:

{-# 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

4

1 に答える 1

2

Unix システムでは、~/.ghcディレクトリを削除して次を実行します。

ghc-pkg --global recache

Windows システムでは (単なる提案です) C:\Users\USERNAME\AppData\Roaming\ghc、コマンドラインから (管理者として) キャッシュを削除し、再キャッシュします。

ghc-pkg --global recache

Windowsについてはわかりません!チェックしてください!

于 2014-03-14T21:06:39.877 に答える