Gabriella439 / Gabriella439/turtle

Abstracting command return types

Open
#210 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
978
Forks
94
PR merge metrics
No merged PRs in 30d

Description

I'm finding my code is doing a lot of this:

```haskell
o1 <- shellStrict cmd1 empty
case o1 of
(ExitFailure, stderr) -> handle err
(ExitSuccess, stdout) -> do

o2 <- shellStrict cmd2 empty
case o2 of
(ExitFailure, stderr) -> handle err
(ExitSuccess, stdout) -> do

...
```

I'd like to abstract this and am wondering why Tuple is used for `procStrict`/`shellStrict` instead of the Either monad, as with `inprocWithErr`/`inshellWithErr`?

I'm not a shell programmer, so I very well may be missing the intended use case.

Here's a related discussion in the context of `shell`:
[Stack Overflow - Composing ExitCodes in Turtle.](https://stackoverflow.com/questions/33225573/composing-exitcodes-in-turtle-why-is-there-no-monad-monad-transformer-instance)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by comparing the return types of procStrict and shellStrict with inprocWithErr and inshellWithErr. Read the linked discussion about composing ExitCodes in Turtle to understand the existing trade-offs. Done means the project has an agreed direction for abstracting command-result composition, but the issue does not identify files or tests to change.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.