McBear Holden
McBear Holden

Reputation: 5901

Haskell stack script extra deps

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
-}

Upvotes: 11

Views: 1494

Answers (2)

bbarker
bbarker

Reputation: 13088

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).

Upvotes: 3

nicolas
nicolas

Reputation: 9805

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

Upvotes: 3

Related Questions