haskell / haskell/cabal

Allow executables to also be scripts

Open
#10,324 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

> ... offer the option to install each standalone *.hs script by listing them as executables in the package.

_Originally posted by @philderbeast in https://github.com/haskell/cabal/issues/10317#issuecomment-2332379427_

Please allow at least single file, self contained executables to be run as scripts. I tried this with #10320 but was rebuffed with:

```
$ ./cabal-validate/main/Main.hs
Warning: this is a debug build of cabal-install with assertions enabled.
Resolving dependencies...
Error: [Cabal-7070]
The run command can only run an executable as a whole, not files or modules within them,
but the target 'main/Main.hs' refers to the file main/Main.hs in the executable cabal-validate.
```

Contributor guide

Open the contributing guide

Research direction

Start with the cabal-install run command and the example target cabal-validate/main/Main.hs. Trace how the command distinguishes an executable from a file or module within one, then determine how a standalone self-contained .hs file listed as an executable should be handled. Done means the requested script can be run without the current whole-executable error.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.