使用堆栈测试Hackage包的工作流程(不在Stackage中) [英] Workflow for using stack to test Hackage packages (not in Stackage)

查看:94
本文介绍了使用堆栈测试Hackage包的工作流程(不在Stackage中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用堆栈执行单独的下载和安装(用于测试和试验)Haskell包在Hackage中,但不在Stackage中的工作流程是什么?



例如

  stack new tester 
cd tester
#然后将package PKG添加到'extra- deps的
堆栈构建。 --force-dirty

是不够的,会导致错误(不是当前模块程序或任何已知软件包),当尝试打包一部分的 import 时。




 

显式构建包(看起来应该不需要) code> stack build PKG

也不起作用(导致警告它是)。

如果我只是简单地

  stack new tester --force 
cd tester
stack build PKG

当我尝试在堆栈ghci 会话中导入程序包组件时,出现相同的隐藏程序包错误。



使用Haskell堆栈为Hackage上的特定软件包创建独立临时安装的工作流程(最佳实践)是什么?

解决方案

为了使用Stackage上不可用的包,我通常首先尝试在全局项目中构建它:

  $ cd〜/ 
$ stack build-package
$ stack ghci

如果这不起作用,通常是因为缺少依赖关系或边界问题,我会采用以下工作流程:

  $ stack new playground 
$ cd playground
#在playground.cabal中,将库添加到库构建依赖部分
$堆栈解析器--update-config
$ stack ghci
#使用包


What is the workflow for using stack to preform an isolated download and install (for testing and experimentation) of a Haskell package that's in Hackage, but not in Stackage?

For example

stack new tester
cd tester
# Then add the package PKG to 'extra-deps'
stack build . --force-dirty

is not sufficient, and results in errors ("not a module in the current program, or in any known package") when an import of part of the package is attempted.

Explicitly building the package (which seems like it shouldn't be necessary) with

stack build PKG

doesn't work either (resulting in warnings that it "is a member of the hidden package PKG...").

If I instead simply

stack new tester --force 
cd tester 
stack build PKG

I get the same "hidden package" error when I try to import a component of the package in a stack ghci session.

What is the (best practice) workflow for using Haskell stack to create an isolated temporary installation for a working with specific package on Hackage?

解决方案

To play with a package that isn't available on Stackage, I usually first try to build it in the global project:

$ cd ~/
$ stack build the-package
$ stack ghci

If that doesn't work, usually because of missing dependencies or bounds issues, I resort to the following workflow:

$ stack new playground
$ cd playground
# In playground.cabal, add the-package to the library build-depends section 
$ stack solver --update-config
$ stack ghci
# Play with the package

这篇关于使用堆栈测试Hackage包的工作流程(不在Stackage中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆