haskell / haskell/cabal

Using cabal as a script interpreter doesn't write output to current working directory

Open
#5,688 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

I am trying to use cabal to run a one-off script which runs a plugin on the file and outputs some information to the current directory. However, the output gets directed somewhere else entirely.

For example:

```
#!/usr/bin/env cabal
{-# LANGUAGE DeriveGeneric , ViewPatterns, PatternSynonyms #-}
{- cabal:
build-depends: base, dump-core, process, criterion, deepseq
ghc-options: -fplugin=DumpCore -fplugin-opt DumpCore:core-html
-}
```

I want the output to be in a folder called `core-html` in the same place as the script. However, it doesn't end up there and I don't know where it ends up.

Contributor guide

Open the contributing guide

Research direction

Reproduce the shebang-based cabal script example with the DumpCore plugin and observe where the core-html output is written. Start at cabal's script interpreter handling and trace how it determines the working directory; done means output is placed in a core-html folder beside the script, with coverage for this invocation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.