MonadFail instance (feature request)
- Dominant language
- Haskell
- Stars
- 118
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
It would be very handy to have a `MonadFail` instance that `retry`s. As a minimal motivating example, consider:
pop :: TVar [a] -> STM a
pop v = do
a:as <- readTVar v
writeTVar v as
return a
With a `MonadFail` instance, this is a very convenient way of writing a transaction that waits until there's a value available in the stack.
More generally, such an instance would allow one to write a transaction as if all your favorite patterns matched, and the transaction would then efficiently block until it's so.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the existing STM retry behavior and the MonadFail instance or related interfaces, using the pop example in the issue as the motivating case. Determine the intended semantics for pattern-match failure, blocking, and transaction retry; the issue is complete only when those semantics and corresponding tests are defined and implemented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100