1

I got a download file from my University for one of my assignments, it has an import Criterion.Main that my version of stack does not recognize

I tried updating my Stack and cabal, added

#!/usr/bin/env stack

to the beginning of my file, and tried running stack fib2.hs (the name of the file with the problematic import), but this only got me these error messages:

stack: WARNING! Expecting stack options comment at line 1, column 1
stack: WARNING! Missing or unusable Stack options specification
stack: WARNING! Using runghc without any additional Stack options
Executable named sh not found on path: [Path]

the file itself had

stack --resolver lts-11.10 script --optimize

put in there by my uni, but when I try to run this I get another error:

Missing: FILE

Usage: stack.exe script [--package PACKAGE] FILE
                    [-- ARGUMENT(S) (e.g. stack script X.hs -- argument(s) to program).]
                    [--compile | --optimize] [--[no-]use-root]
                    [--ghc-options OPTIONS] [--extra-dep PACKAGE-VERSION]
                    [--no-run] [--setup-info-yaml URL]
                    [--snapshot-location-base URL] [--help]

Run a Stack script

What am I doing wrong?

2
  • Something somewhere is pointing to an sh executable. You can see that from the last bit of the error message Stack options Executable named sh not found on path: [Path]. You can also run a script by executing stack [script_filename], which might work or maybe give you another error. Commented Jul 23, 2023 at 16:17
  • 1
    Your problem seems to have nothing to do with the Criterion import really, this is a deeper setup issue. You should try to first get Stack working with a simple Hello World program. Commented Jul 23, 2023 at 16:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.