11

In a normal stack project, I can add extra-deps in the stack.yaml file:

extra-deps:
- text-1.2.2.0
- unm-hip-0.3.1.6
- safe-exceptions-0.1.4.0
- quickcheck-properties-0.1
- time-interval-0.1.1
- time-units-1.0.0
- snowball-1.0.0.1
- dictionaries-0.1.0.0
resolver: lts-8.3

allow-newer: true

But how do I do this in a script?

#!/usr/bin/env stack
{- stack
    --resolver lts-8.5
    --install-ghc
    runghc
    --package MissingH
    --package process
    --package attoparsec
    --package split
    --package dictionaries
    --package bytestring
-}
McBear Holden
  • 5,741
  • 7
  • 33
  • 55

2 Answers2

3

It is possible to specify extra packages on the commande line using e.g.

stack runghc --resolver lts-12.20 --package raven-haskell-0.1.2.0 ./using-sentry.hs

it does not work with shebang style, inside the file AFAICT

nicolas
  • 9,549
  • 3
  • 39
  • 83
3

When using shebang style, you can (now at least) do --extra-dep mypackage-1.3.3.7 within the script.

Credit to @lyxia for pointing me to this (and more generally that I should check stack script --help).

bbarker
  • 11,636
  • 9
  • 38
  • 62