
27 May
2019
27 May
'19
1:29 p.m.
On Mon, May 27, 2019 at 05:46:11AM -0400, Viktor Dukhovni wrote:
The generalized Monadic version will short-circuit.
(<&&>) :: Monad m => m Bool -> m Bool -> m Bool (<&&>) ma mb = ma >>= (\a -> if not a then return False else mb)
(<||>) :: Monad m => m Bool -> m Bool -> m Bool (<||>) ma mb = ma >>= (\a -> if a then return True else mb)
I should mention that a compatible even better generalized interface is available via Control.Selective: (<||>): http://hackage.haskell.org/package/selective-0.2/docs/Control-Selective.html... (<&&>): http://hackage.haskell.org/package/selective-0.2/docs/Control-Selective.html... -- Viktor.