0

Been playing around with Yesod for a few weeks. Installed stack on freebsd. Got a templated postgresql site working. Now trying to test out Esqueleto for a join query.

Installed esqueleto as so:

   stack update
   stack install esqueleto

my handler file

cat -n src/Handlers/Addcontainer.hs

  1 {-# LANGUAGE NoImplicitPrelude #-}
  2 {-# LANGUAGE OverloadedStrings #-}
  3 {-# LANGUAGE TemplateHaskell #-}
  4 {-# LANGUAGE MultiParamTypeClasses #-}
  5 {-# LANGUAGE TypeFamilies #-}
  6 {-# LANGUAGE QuasiQuotes #-}
  7 module Handler.Addcontainer where
  8
  9 import Import
 10 import qualified Database.Esqueleto.Experimental      as E
 11 -- import           Database.Esqueleto      ((^.))
 12
 13
 14 getAddcontainerR :: Handler Html
 15 getAddcontainerR = do
 16   defaultLayout $ do
 17     setTitle "Add a container!"
 18     [whamlet|<p>The place to add a new container!|]

Added ", esqueleto" to .cabal file.

stack exec -- yesod devel

Receive following error message.

4 of 15] Compiling Handler.Addcontainer

/usr/home/abner/projects/active/create-database-app-to-organize-tools/asset03/src/Handler/Addcontainer.hs:10:1: error:
    Could not load module ‘Database.Esqueleto.Experimental’
    It is a member of the hidden package ‘esqueleto-3.5.8.1’.
    Perhaps you need to add ‘esqueleto’ to the build-depends in your .cabal file.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
10 | import qualified Database.Esqueleto.Experimental      as E
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Error: [S-7282]
       Stack failed to execute the build plan.

       While executing the build plan, Stack encountered the following errors:

       [S-7011]
       While building package asset03-0.0.0 (scroll up to its section to see the error) using:
       /usr/home/abner/.stack/setup-exe-cache/x86_64-freebsd-ino64/Cabal-simple_SvXsv1f__3.6.3.0_ghc-9.2.5 --verbose=1 --builddir=.stack-work/dist/x86_64-freebsd-ino64/Cabal-3.6.3.0 build lib:asset03 exe:asset03 --ghc-options " -fdiagnostics-color=always"
       Process exited with code: ExitFailure 1

Interestingly, to me anyway, when I check my .cabal file afterwards the lines referencing "esqueleto" have dissappeared.

I'm working alone as a hobbiest, new to Haskell, and new to Yesod but have read through some of the Yesod book. Any help appreciated.

I tried adding, import Database.Esqueleto.Experimental , to other files as well such as Foundation.hs but this only increased the number of error messages as now there were two files for which the esqueleto module could not be found.

Abner
  • 31
  • 3

1 Answers1

0

On a lark I added - esqueleto to the dependencies section of my packages.yaml file and this fixed the problem. I haven't tried running any acutual esqueleto queries yet but at least the program compiles and is able to find the esqueleto module.

Abner
  • 31
  • 3