Skip to content

Instantly share code, notes, and snippets.

@k0001
Created December 15, 2017 00:55
Show Gist options
  • Save k0001/c1f15404dedd78d2ec0f5b765342a4ec to your computer and use it in GitHub Desktop.
Save k0001/c1f15404dedd78d2ec0f5b765342a4ec to your computer and use it in GitHub Desktop.
> (||) <$> (putStrLn "x" >> pure True) <*> (putStrLn "y" >> pure False)
x
y
True
> let mor = \ma mb -> ma >>= \a -> if a then pure True else mb
> :t mor
mor :: Monad m => m Bool -> m Bool -> m Bool
> mor (putStrLn "x" >> pure True) (putStrLn "y" >> pure False)
x
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment