haskell - 将依赖项添加到堆栈项目
问题描述
我对 Haskell 很陌生,我正在尝试将图形包光泽添加到我的堆栈项目中,但是在执行时遇到了问题stack build
。
我创建了我的堆栈项目,如下所示:
LICENSE package.yaml stack.yaml
README.md package.yaml~ stack.yaml.lock
Setup.hs project39.cabal stack.yaml~
TAGS project39.cabal~ test
并编辑stack.yaml
和cabal文件如下:
# extra-deps:
# - acme-missiles-0.3
# - git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# - gloss-1.13.2.1
executable project39-exe
main-is: Main.hs
other-modules:
Paths_project39
hs-source-dirs:
app
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.7 && <5
, project39
, gloss
default-language: Haskell2010
在src
Lib.hs 文件中,我添加了一个Import Graphics.Gloss
来测试它是否有效:
module Lib
( someFunc
) where
import Graphics.Gloss
但是当我这样做时,stack build
我收到以下错误:
Could not load module ‘Graphics.Gloss’
It is a member of the hidden package ‘gloss-1.13.2.1’.
Perhaps you need to add ‘gloss’ to the build-depends in your .cabal file.
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
4 | import Graphics.Gloss
| ^^^^^^^^^^^^^^^^^^^^^
我不确定这里的问题是什么以及如何解决它。
解决方案
您的 package.yaml 中有一个单独的library
节。您需要在gloss
此处添加依赖项。
推荐阅读
- java - 如何将显示传递给 qsub 命令?
- qt - 在“AppListView”中是加载器应该使用“SimpleRow”加载组件的空白位置
- postman - 我可以在 newman 中使用邮递员集合变量吗?
- r - R - 如何在 R 中绘制核心数据?
- sql - 如何在 postgresql 中存储多边形数据?
- gradle - asciidoctor 在 gradle 中未运行(或未正常运行)
- php - 未知单词来自 wordpress 中的页面
- java - 为什么在内部存储而不是外部存储中创建新文件夹?
- python - Python Speech_recognition.UnknownValueError
- javascript - 从客户端站点自动预填充网络表单