stack.yaml 不依赖于 github

Mic*_*ard 3 haskell haskell-stack

这是 stack.yaml 节

包:

- location:
   git: https://github.com/TwitterFriends/lsh.git
   commit: 57d57f4209e56f526c0eca023907015935c26071
   extra-dep: true
Run Code Online (Sandbox Code Playgroud)

我将包添加到 cabal 文件中

当我尝试构建时出错

While constructing the BuildPlan the following exceptions were encountered:

--  While attempting to add dependency,
    Could not find package lsh in known packages
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

当前项目在这里找到

https://github.com/TwitterFriends/twitter-friend-server

She*_*rsh 5

问题是语法。您在 之前添加了一些额外的空格extra-dep。把这个放在stack.yaml. 有了这个,你的项目就建立在我的机器上。

- location:
    git: https://github.com/TwitterFriends/lsh.git
    commit: 57d57f4209e56f526c0eca023907015935c26071
  extra-dep: true
Run Code Online (Sandbox Code Playgroud)

更新: (2017 年 12 月 17 日)

由于stack-1.6.1添加 github 依赖项的语法已更改。您需要将您的 github 依赖项添加到extra-deps字段中。像这样的东西:

resolver: lts-9.17
packages: [.]

extra-deps:
- fmt-0.5.0.0
- git: https://github.com/TwitterFriends/lsh.git
  commit: 57d57f4209e56f526c0eca023907015935c26071
Run Code Online (Sandbox Code Playgroud)

更新: (2019 年 12 月 5 日)

stack-2.1.3你可以在指定GitHub的依赖extra-deps甚至更短的语法:

extra-deps:
- github: TwitterFriends/lsh
  commit: 57d57f4209e56f526c0eca023907015935c26071
Run Code Online (Sandbox Code Playgroud)