我想安裝這個程式
https://github.com/hackage-trustees/hackage-cli
這樣做的簡單方法是什么?
如果我嘗試在本地構建它
> cabal --version
cabal-install version 3.4.1.0
compiled using version 3.4.1.0 of the Cabal library)
我明白了
? cabal v1-build
Resolving dependencies...
Warning: solver failed to find a solution:
Could not resolve dependencies:
[__0] trying: hackage-cli-0.1.0.0 (user goal)
[__1] next goal: base (dependency of hackage-cli)
[__1] rejecting: base-4.15.1.0/installed-4.15.1.0 (conflict: hackage-cli =>
base>=4.10.0.0 && <4.13)
[__1] fail (backjumping, conflict set: base, hackage-cli)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: hackage-cli, base
Trying configure anyway.
Configuring hackage-cli-0.1.0.0...
cabal: Encountered missing or private dependencies:
Cabal >=2.4.1.0 && <2.5,
aeson >=1.4.2.0 && <2.1,
base >=4.10.0.0 && <4.13,
http-io-streams >=0.1.0.0 && <0.2,
io-streams >=1.5.0.1 && <1.6,
lens >=4.17 && <5.2,
netrc >=0.2.0.0 && <0.3,
optparse-applicative >=0.14 && <0.17,
process-extras >=0.7.4 && <0.8,
semigroups >=0.18.3 && <0.21,
stringsearch >=0.3.6 && <0.4,
tagsoup >=0.14 && <0.15,
tar >=0.5 && <0.6,
unordered-containers >=0.2.7 && <0.3,
zlib >=0.6.1 && <0.7
.
? cabal v2-build
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: hackage-cli-0.1.0.0 (user goal)
[__1] next goal: base (dependency of hackage-cli)
[__1] rejecting: base-4.15.1.0/installed-4.15.1.0 (conflict: hackage-cli =>
base>=4.10.0.0 && <4.13)
[__1] skipping: base-4.16.0.0, base-4.15.1.0, base-4.15.0.0, base-4.14.3.0,
base-4.14.2.0, base-4.14.1.0, base-4.14.0.0, base-4.13.0.0 (has the same
characteristics that caused the previous version to fail: excluded by
constraint '>=4.10.0.0 && <4.13' from 'hackage-cli')
[__1] rejecting: base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0,
base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0,
base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1,
base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0,
base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0,
base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from
non-upgradeable package requires installed instance)
[__1] fail (backjumping, conflict set: base, hackage-cli)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, hackage-cli
.
? stack init
Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- ./
- fixtures/
Multiple .cabal files found in directory /Users/nrolland/clones/hackage-cli/fixtures/:
- SVGFonts.2.cabal
- SVGFonts.0.cabal
- SVGFonts.1.cabal
- deepseq.1.cabal
- tree-diff.1.cabal
- semigroups.2.cabal
- semigroups.0.cabal
- tree-diff.0.cabal
- deepseq.0.cabal
- semigroups.1.cabal
uj5u.com熱心網友回復:
簡短的回答
解決方案如下。或者,您可以從以下位置克隆:
https://github.com/kabuhr/hackage-cli
得到一個stack build準備好的版本。請注意,您可能需要apt install libbrotli-dev或類似之前stack build的 .
長答案
在這里,stack init被子目錄.cabal中的一些額外檔案所迷惑。fixtures你可以通過運行來解決這個問題stack init --ignore-subdirs。這最終選擇了決議器lts-14.27,但由于http-io-streams不在 Stackage 中而失敗:
Selected resolver: https://raw.githubusercontent.com/
commercialhaskell/stackage-snapshots/master/lts/14/27.yaml
Resolver 'https://raw.githubusercontent.com/commercialhaskell/
stackage-snapshots/master/lts/14/27.yaml' does not have all
the packages to match your requirements.
http-io-streams not found
- hackage-cli requires ^>=0.1.0.0
你可以運行:
stack init --resolver lts-14.27 --ignore-subdirs --omit-packages
無論如何都要生成一個stack.yaml,然后添加一些extra-depsforhttp-io-streams和它所依賴的任何東西。經過一番擺弄,我想出了以下內容stack.yaml:
resolver: lts-14.27
packages:
- .
extra-deps:
- http-io-streams-0.1.2.0
- brotli-streams-0.0.0.0
- brotli-0.0.0.0
需要一個額外的補丁,因為支持aeson早于 2.0.0.0 版本的代碼已損壞。應用以下補丁:
diff --git a/src/IndexShaSum.hs b/src/IndexShaSum.hs
index 0296dff..bdfc4df 100644
--- a/src/IndexShaSum.hs
b/src/IndexShaSum.hs
@@ -35,14 35,15 @@ import Data.Semigroup ((<>))
#if MIN_VERSION_aeson(2,0,0)
import qualified Data.Aeson.Key as Key
import qualified Data.Aeson.KeyMap as KeyMap
type Key = J.Key
-keyToText :: J.Key -> Text
keyToText :: Key -> Text
keyToText = Key.toText
#else
import qualified Data.HashMap.Strict as KeyMap
type Key = Text
-keyToText :: J.Key -> Text
keyToText :: Key -> Text
keyToText = id
#endif
@@ -139,7 140,7 @@ decodePkgJsonFile bs = do
go2 m = forM (KeyMap.toList m) $ \(k,v) -> do
J.withObject ".targets{}" (go3 k) v
- go3 :: J.Key -> J.Object -> J.Parser (ByteString, ByteString)
go3 :: Key -> J.Object -> J.Parser (ByteString, ByteString)
go3 k o = do
hashes <- o J..: "hashes"
sh256 <- hashes J..: "sha256"
With that patch applied, and the stack.yaml in place, you should be able to run stack build. If you get an error about building package brotli, you'll probably need development files for the brotli library installed (e.g., apt install libbrotli-dev on Debian flavors).
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/427256.html
標籤:哈斯克尔
上一篇:為什么TypeApplications不允許使用部分應用的型別同義詞
下一篇:普通函式和型別類函式有什么區別?
