Created
May 22, 2015 10:03
-
-
Save UnkindPartition/32b1d925baa3bc0e6b89 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad.Logic | |
import Control.Monad.Trans.Maybe | |
zipLogic :: (MonadLogic m) => m a -> m b -> m (a, b) | |
zipLogic gx gy = | |
maybe mzero return <=< runMaybeT $ do | |
(x, rx) <- MaybeT (msplit gx) | |
(y, ry) <- MaybeT (msplit gy) | |
lift $ return (x, y) `mplus` zipLogic rx ry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment