Search code examples
haskellhaskell-stack

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

Solution

  • 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