本文介绍了Haskell:针对Hackage的多个版本的基础测试一个包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎是完全可以接受的理由来拒绝我的包裹。



是否有一个很好的工具来测试我的包对 base 的各种版本,所以我可以看到界限是什么(而不仅仅是猜测)?我能想到的最好的方法是使用一些shell脚本来执行类似操作:

 %for v in $ BASE_VERSIONS 

cabal install base- $ v&& \
cabal configure - 启用测试&& \
cabal build&& \
cabal测试&&回声$ v ok||回声$ v失败
完成

但我觉得应该有更好的东西。

解决方案

这是一个非常糟糕的主意!您必须 升级base或在标签栏中有 - ),否则一切都会崩溃。

使用旧版本的基础是安装一个旧的GHC并测试。我建议在7.0.4和7.2.2上试试;支持旧版本可能是浪费时间。



如果没有,只需指定 base> = VERSION&& < 5 ,其中 VERSION 是GHC的版本。或 base == 4。* 并希望最好:)

严肃地说,base的API不会' t真的改变了很多,所以你不可能遇到很多问题。



用一般的软件包测试你的程序,而不会干扰你的main 〜/ .cabal 存储库,我强烈建议 cabal-dev ;像

  $ cabal-dev install'pkg == VERSION'
$ cabal-dev install




$ p $应该这样做。

顺便说一下,在上传程序包到Hackage之前,您可以做 cabal check 来获得警告。


I'm trying to upload my first package to Hackage (yay!), and I got this error:

Which seems like a perfectly acceptable reason to decline my package.

Is there a good tool to test my package against various versions of base so I can see what the bounds are (rather than just guessing)? The best I can think of is to use some shell scripting to do something like:

% for v in $BASE_VERSIONS
do
  cabal install base-$v &&\
  cabal configure --enable-tests &&\
  cabal build &&\
  cabal test && echo "$v ok" || echo "$v fail"
done

But I feel like there should be something better.

解决方案

This is a very bad idea! You must not upgrade base or any other packages that come with GHC (the ones with - in the tag column), or everything will break horribly.

The only way to test with an older version of base is to install an older GHC and test with that. I would suggest just trying it on 7.0.4 and 7.2.2; supporting older versions is probably a waste of time these days.

Failing that, just specify base >= VERSION && < 5, where VERSION is the version your GHC has. Or base == 4.* and hope for the best :)

In all seriousness, base's API doesn't really change all that much, so you're unlikely to run into many problems with this.

For testing your program with various versions of packages in general without disturbing your main ~/.cabal repository, I strongly recommend cabal-dev; something like

$ cabal-dev install 'pkg==VERSION'
$ cabal-dev install
$ cabal-dev test

should do it.

By the way, you can do cabal check to get warned about problems like this before uploading your package to Hackage.

这篇关于Haskell:针对Hackage的多个版本的基础测试一个包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 16:43