为什么不将堆栈添加到ghc包数据库? [英] Why doesn't stack add packages to the ghc package database?

查看:155
本文介绍了为什么不将堆栈添加到ghc包数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经决定尝试给堆叠一枪。我已经安装并使用它来安装最新版本的ghc。我使用堆栈来安装一些软件包,但软件包对ghc不可见,并且当我使用ghc-pkg列出软件包时,我发现我通过堆栈安装的软件包不在那里。为什么是这样?我是否误解了堆栈的用途?

解决方案

堆栈永远不会触及全局包数据库。它使用分层数据库方法


  1. 全局数据库 - 未触及

  2. 包中的堆栈快照安装到快照数据库中

  3. 其他软件包在每个项目本地安装

因此,不是污染全局数据库,大多数包都安装在快照数据库中,因此大多数包都可以共享。由于堆栈快照中的包是兼容的(即总是一起编译),所以我们不会遇到 Cabal hell

您可以使用 stack ghci stack ghc 以运行相应的命令并配置包数据库。



更精确的解释在堆栈wiki 中。


I've decided to try giving stack a shot. I've installed it and used it to install the latest version of ghc. I've used stack to install some packages but the packages are not visible to ghc and when I list packages with ghc-pkg I see that the packages that I've installed through stack are not there. Why is this? Am I misunderstanding the purpose of stack?

解决方案

Stack never touches global packages database. It uses layered database approach

  1. global database - untouched
  2. packages in the stackage snapshot are installed into snapshot database
  3. other packages are installed locally per project

Thus instead of polluting global database, most packages are installed in snapshot database(s), so most packages can be shared. As packages in stackage snapshots are compatible (i.e. always compile together), we don't run into Cabal hell.

You can use stack ghci or stack ghc to run corresponding commands with package database configured.

The more precise explanation is in the stack wiki

这篇关于为什么不将堆栈添加到ghc包数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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