Stack: Add an example of how to add a dependency to a project to the README and/or Wiki

Created on 3 Jul 2015  Â·  7Comments  Â·  Source: commercialhaskell/stack

It appears that my immediate assumption (that you just modify the stack.yml file) was wrong, and you also need to modify the cabal file.

documentation

Most helpful comment

I'm a total newbie at both cabal and stack, so I'm pretty far from confident that I really know what goes where. What would be super helpful would be something saying "Here's what goes in stack.yml" and "Here's what goes in .cabal".

Alternatively, if the expectation is that all consumers are already familiar with cabal, a link to that documentation would be adequate, but I'd assume that's not the intention.

All 7 comments

You're correct about needing to modify the cabal file. Stack still depends on cabal files and the Cabal library. Want to add a note somewhere?

I'm a total newbie at both cabal and stack, so I'm pretty far from confident that I really know what goes where. What would be super helpful would be something saying "Here's what goes in stack.yml" and "Here's what goes in .cabal".

Alternatively, if the expectation is that all consumers are already familiar with cabal, a link to that documentation would be adequate, but I'd assume that's not the intention.

This is the kind of documentation that we should be adding for the new-to-Haskell case. @hmrm it's very valuable to have input from someone who isn't already intimately familiar with how Haskell packaging works. @chreekat would you be interested in participating in the process of helping extend the documentation for this? I'm guessing @drwebb may have some ideas on this too.

@snoyman I'm busy simplifying Snowdrift docs by switching the build process
over to stack. :) Best I can do right now is write the following:

When modifying a Haskell package that is built with stack, it is still
necessary to update the package's cabal file. Add any new library
dependencies to the build-depends list for that project. If you are lucky,
the new dependency already exists in Stackage, and no further work is
required. Otherwise, you will also need find the best version of the
dependency (stack build will suggest one) and add it to the extra-deps list in your
stack.yaml.

When you try to do a stack build, and there's a missing dependency that is
on hackage, stack will print an error message that suggests a version of
that package. Usually you can just copy/paste it straight from the error
message into your stack.yaml. Sometimes the suggested version doesn't work
and you have to manually intervene. I believe stack just suggests the
latest version.

On Friday, July 3, 2015, Bryan Richter [email protected] wrote:

@snoyman I'm busy simplifying Snowdrift docs by switching the build process
over to stack. :) Best I can do right now is write the following:

When modifying a Haskell package that is built with stack, it is still
necessary to update the package's cabal file. Add any new library
dependencies to the build-depends list for that project. If you are lucky,
the new dependency already exists in Stackage, and no further work is
required. Otherwise, you will also need find the best version of the
dependency [best way to do this?] and add it to the extra-deps list in your
stack.yaml.

On Fri, Jul 3, 2015 at 2:26 PM, Michael Snoyman <[email protected]
wrote:

This is the kind of documentation that we should be adding for the
new-to-Haskell case. @hmrm https://github.com/hmrm it's very valuable
to have input from someone who isn't already intimately familiar with how
Haskell packaging works. @chreekat https://github.com/chreekat would
you be interested in participating in the process of helping extend the
documentation for this? I'm guessing @drwebb https://github.com/drwebb
may have some ideas on this too.

—
Reply to this email directly or view it on GitHub
<
https://github.com/commercialhaskell/stack/issues/510#issuecomment-118428109

.

—
Reply to this email directly or view it on GitHub
https://github.com/commercialhaskell/stack/issues/510#issuecomment-118428599
.

-- Dan Burton

Thanks @DanBurton — blurb edited.

This documentation is being added to the wiki page in #489. Closing

Was this page helpful?
0 / 5 - 0 ratings