We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A MonadMask constraint absorber with the following type signature:
MonadMask
absorbMaskAsIO :: Member (Final IO) r => (MonadMask (Sem r) => Sem r a) -> Sem r a
Should be possible by lifting uninterruptible/Mask à la polysemy-research/polysemy#135 (comment) and lifting generalBracket through the following:
uninterruptible
Mask
generalBracket
generalBracket :: Member (Final IO) r => Sem r a -> (a -> ExitCase b -> Sem r c) -> (a -> Sem r b) -> Sem r (b, c) generalBracket alloc dealloc use = withStrategicToFinal $ do alloc' <- runS alloc dSuccess <- bindS (\(a, b) -> (b ,) <$> dealloc a (ExitCaseSuccess b)) dFailure <- bindS (uncurry dealloc) use' <- bindS (\a -> (,) a <$> use a) ins <- getInspectorS pure $ X.mask $ \restore -> do res <- alloc' fb <- restore (use' res) `X.catch` \e -> do _ <- dFailure $ (, ExitCaseException e) <$> res X.throwIO e if isJust (inspect ins fb) then dSuccess fb else do _ <- dFailure $ (, ExitCaseAbort) <$> res return ((\(_,_) -> bomb "generalBracket") <$> fb) bomb :: String -> a bomb str = error $ str ++ ": Uninspectable effectful state still carries a visible result.\ \ You're probably using an interpreter\ \ that uses 'weave' improperly.\ \ See documentation for more information."
The text was updated successfully, but these errors were encountered:
Weaving
Sem r
If we figure out polysemy-research/polysemy#304, and implement the Mask effect described there, we can also do:
absorbMask :: Member (Mask s) r => (MonadMask (Sem r) => Sem r a) -> Sem r a
Sorry, something went wrong.
No branches or pull requests
A
MonadMask
constraint absorber with the following type signature:Should be possible by lifting
uninterruptible
/Mask
à la polysemy-research/polysemy#135 (comment) and liftinggeneralBracket
through the following:The text was updated successfully, but these errors were encountered: