Could not find module 'Yesod'

I have the following code:

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

      

If you run it in GHCI, it works fine:

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

      

But if you run it like:

wai-handler-devel 3000 Simple withHelloWorld

      

the console reports an error:

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.

      

What could be the problem? Yesod is installed and displayed in the output ghc-pkg list

.

+3


source to share


1 answer


On Unix systems delete the directory ~/.ghc

and run:

ghc-pkg --global recache

      

On windows systems (just a suggestion) remove C:\Users\USERNAME\AppData\Roaming\ghc

as well as recache from command line (as administrator):



ghc-pkg --global recache

      

Not sure about Windows! Please check!

+2


source







All Articles