Run a statement directly with `cabal v2-repl --run "func"`
Open
type: enhancement
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
## Problem
Currently it's possible to run a statement with shell piping but this gives a noisy output:
```bash
$ cabal v2-repl <<< ':type zip'
[ 1 of 40] Compiling..
..
Ok, 40 modules loaded.
ghci> zip :: [a] -> [b] -> [(a, b)]
ghci> Leaving GHCi.
$ cabal v2-repl <<< ':type zip' | wc -l
48
```
(From https://stackoverflow.com/questions/58600068/how-can-i-run-a-ghci-statement-in-cabal-v2-repl-directly-from-command-line)
## Proposal
It would be great to have a `--run ` that produces a one line output.
This would be useful to test IO in certain cases. For example, to produce a SQL query and then run it:
```bash
$ cabal v2-repl --run "Module.produceQuery" | psql
```
Contributor guide
Assessment
This issue has not been assessed yet.