brandonchinn178 / brandonchinn178/checked-io

Optimize mapExceptionM

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
5
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Instead of `mapExceptionM` needing to catch and transform exceptions immediately, we could just track a `AnyException SomeException -> e` function that would defer the transformation to when the exception is actually caught.
```hs
mapExceptionM f (UnsafeIOE (io, convertE)) = UnsafeIOE (io, f . convertE)

catchAnyM (UnsafeIOE (m, convertE)) f =
withRunAsIOE $ \run ->
UnsafeIOE (m `GHC.catch` (unIOE . run . f . convertE), castAnyException)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating mapExceptionM, catchAnyM, and UnsafeIOE in the Haskell sources, then read how exceptions are currently converted and caught. Verify the proposed deferred transformation preserves the existing exception behavior, and add or update tests for both mapping and catching before considering the refactor complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
backend
Issue type
Refactor
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.