Skip to content

MonadFail instance (feature request) #59

@dmwit

Description

@dmwit

It would be very handy to have a MonadFail instance that retrys. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions