ianmackenzie / ianmackenzie/elm-script

Function for mapping both error and ok

Open
#18 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elm
Stars
34
Forks
5
PR merge metrics
No merged PRs in 30d

Description

```elm
mapBoth : (Result e a -> Result e1 a1) -> Script e a -> Script e1 a1
mapBoth map =
Script.attempt
>> Script.thenWith
(\result ->
case map result of
Ok ok ->
Script.succeed ok

Err err ->
Script.fail err
)
```
It would be nice to have a function like this as it's not entirely obvious how to implement it with the existing functions and it's useful to have this level of flexibility sometimes.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.