Avoid calling failure continuation in msplit

This commit is contained in:
Danila Fedorin 2023-03-12 00:31:02 -08:00
parent 9f91c31b2d
commit e19721af5e
1 changed files with 2 additions and 1 deletions

View File

@ -59,7 +59,8 @@ instance MonadTrans SFKT where
lift m = SFKT (\sk fk -> m >>= (\a -> sk a fk))
instance Monad m => MonadLogic (SFKT m) where
msplit ma = lift (unSFKT ma (\a fk -> pure (Just (a /\ (lift (fk unit) >>= reflect)))) (\_ -> pure Nothing))
msplit ma = lift (unSFKT ma (\a fk -> pure (Just (a /\ (lazyLift fk >>= reflect)))) (\_ -> pure Nothing))
where lazyLift f = SFKT (\sk fk -> f unit >>= (\a -> sk a fk))
interleave m1 m2 = do
r <- msplit m1
case r of