You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for MonadKill you need MonadThrow, i tried to implement it with Either MyError Aff.Error as error type, but i still have to do kill (Aff.error "kill") as in that case there is no Error around:
instancemonadThrowM :: MonadThrow (EitherMyErrorAff.Error) (Me) where
throwError (Left e) = M $ ExceptT $ pure $ Left e
throwError (Right e) = M $ ExceptT $ throwError e
instancemonadKillM ∷ MonadKill (EitherMyErrorAff.Error) (Compose (Aff.Fibereff) (EitherMyError)) (Meff) where
kill (Left e) (Compose f) = M $ ExceptT $ kill (Aff.error "kill") f $> Left e
kill (Right e) (Compose f) = M $ ExceptT $ map Right $ kill e f
for MonadBracket we need MonadError:
instancemonadErrorM :: MonadError (EitherMyErrorAff.Error) (Me) where
catchError x f = do
res <-M $ ExceptT $ map Right $ Aff.try (runM x)
case res ofLeft e -> f $ Right e
Right (Left e) -> f $ Left e
Right (Right a) -> pure a
But I got stack with bracket function of MonadBracket (uninterruptible and never are trivial to implement).
is it possible to implement correct bracket instance for ExceptT at all?
What should you do if you want some error type in your monad other then Error, is there some way which makes it possible to implement MonadBracket but still have custom error type?
The text was updated successfully, but these errors were encountered:
I tried to implement some of this classes with ExceptT
MonadFork with
Compose (Aff.Fiber eff) (Either MyError)
as fiber could be implemented just finefor MonadKill you need MonadThrow, i tried to implement it with
Either MyError Aff.Error
as error type, but i still have to dokill (Aff.error "kill")
as in that case there is noError
around:for MonadBracket we need MonadError:
But I got stack with
bracket
function of MonadBracket (uninterruptible and never are trivial to implement).is it possible to implement correct bracket instance for ExceptT at all?
What should you do if you want some error type in your monad other then
Error
, is there some way which makes it possible to implement MonadBracket but still have custom error type?The text was updated successfully, but these errors were encountered: