1
votes

I installed Yesod according to the quick start guide.

I bought the book "Seven Web frameworks in seven weeks" and I'm trying to follow along. I'm on page 204 (Day 1: Working with models). When I enter

ghci Model.hs

in order to enter some data into the database, as the book says, I get this:

GHCi, version 7.8.3: http://www.haskell.org/ghc/  :? for help 
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.

Model.hs:3:8:              
    Could not find module ‘ClassyPrelude.Yesod’ 
    Use -v to see a list of the files searched for.    

Model.hs:4:8:                                   
    Could not find module ‘Database.Persist.Quasi’ 
    Use -v to see a list of the files searched for.
Failed, modules loaded: none.  

I'm stuck. I'm new to Haskell (but not a newbie) and Yesod, so I don't know what to do.

Thanks in advance.

2
Can you give some more details for those of us who do not have the book, then we might be able to help you....Brian Tompsett - 汤莱恩
I thought posting text as an image was annoying, but posting text as a video, now that's annoying.JJJ
I would suggest you to avoid learning Yesod without getting a grasp of Haskell.Sibi

2 Answers

5
votes

The instructions in this quick start guide led you to create a sandbox for your project, thus the dependencies you installed are only available within this sandbox (which is the cautious and arguably correct way to do it, avoiding collisions and easing the cleanup). GHCi is part of GHC and unaware of the sandbox (which is a concept for and from cabal only).

To start an interactive shell in the sandbox launch cabal repl from the root directory of your project, then use :load src/Model.hs if Model.hs is in src.

1
votes

It seems that you don't have the classy-prelude-yesod package installed. If you have cabal installed, you can easily install any missing package. To do this, you can enter on your OS command prompt the following:

cabal install classy-prelude-yesod

You can use the same method if you are missing any other packages.