Skip to content

Self-executing scripts don't pipe plan construction errors from runhaskell to terminal #3942

@adlaika

Description

@adlaika

General summary/comments

Self-executing scripts don't pipe plan construction errors from runhaskell to terminal.

Steps to reproduce

Given a stack.yaml that uses a package that relies on another package from extra-deps:

resolver: lts-8.22

packages:
- location:
    git: [email protected]:cjdev/cloudseeder.git
    commit: c7068f25c41bcc0b4bdfc9b38ee5b05b5caefae5
  extra-dep: true

extra-deps:
- optparse-applicative-0.14.0.0

flags: {}

extra-package-dbs: []

...and a self-executing script that references that package, called script.hs:

#!/usr/bin/env stack
-- stack runhaskell --package cloud-seeder

main :: IO ()
main = putStrLn "yo"

Expected

With the - optparse-applicative-0.14.0.0 line in place, running gives the expected result:

$ ./script
yo
$ stack runhaskell --package cloud-seeder ./script.hs
yo

Actual

However, if we remove - optparse-applicative-0.14.0.0, only the direct call to runhaskell returns useful error information:

$ ./script
Plan construction failed.
$ stack runhaskell --package cloud-seeder ./script.hs

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for cloud-seeder-0.1.0.0:
    optparse-applicative-0.13.2.0 from stack configuration does not match >=0.14.0.0 (latest matching version is 0.14.2.0)
needed since cloud-seeder is a build target.

Some potential ways to resolve this:

  * Recommended action: try adding the following to your extra-deps in /Users/marnold/Code/lambda/runhaskell-test/stack.yaml:

- optparse-applicative-0.14.2.0

  * Set 'allow-newer: true' to ignore all version constraints and build anyway.

  * You may also want to try using the 'stack solver' command.

Plan construction failed.

Stack version

$ stack --version
Version 1.6.5, Git revision 24ab0d6ff07f28276e082c3ce74dfdeb1a2ca9e9 (5514 commits) x86_64 hpack-0.20.0

Method of installation

  • Official binary, downloaded from stackage.org or fpcomplete's package repository

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions