Yesod Esqueleto:无法加载模块;隐藏包‘esqueleto-3.5.8.1’的成员

问题描述 投票:0回答:0

和 Yesod 一起玩了几个星期。在 freebsd 上安装堆栈。有一个模板化的 postgresql 站点正在运行。现在尝试测试 Esqueleto 的连接查询。

这样安装的esqueleto:

   stack update
   stack install esqueleto

我的处理程序文件

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!|]

在 .cabal 文件中添加了“, esqueleto”。

stack exec -- yesod devel

收到以下错误消息。

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

有趣的是,无论如何对我来说,当我之后检查我的 .cabal 文件时,引用“esqueleto”的行已经消失了。

我作为一个业余爱好者独自工作,Haskell 的新手,以及 Yesod 的新手,但已经阅读了一些 Yesod 的书。任何帮助表示赞赏。

我尝试将

import Database.Esqueleto.Experimental
添加到其他文件,例如 Foundation.hs,但这只会增加错误消息的数量,因为现在有两个文件找不到 esqueleto 模块。

yesod esqueleto
© www.soinside.com 2019 - 2024. All rights reserved.