You can still use the monadic combinators, with the price of wrapping and
unwrapping in case of newtype.
newtype P a = P {unP :: a -> Bool}
liftM2'P :: (Bool -> Bool -> Bool) -> P a -> P a -> P a
liftM2'P op = (P .) . on (liftM2 op) unP
paolino
2012/7/8 Sebastián Krynski
> Ok , thanks for th
On Sat, Jul 07, 2012 at 09:42:01PM -0300, Sebastián Krynski wrote:
> Ok , thanks for the answers, I understand now what liftM2 does.
> In this case would it be silly to use combinerPred (and maybe a newType
> Predicate a = a -> Bool) for the sake of readability or shoud I stick with
> a -> Boo
Ok , thanks for the answers, I understand now what liftM2 does.
In this case would it be silly to use combinerPred (and maybe a newType
Predicate a = a -> Bool) for the sake of readability or shoud I stick with
a -> Bool and liftM2?
thanks, Sebastián
2012/7/6 Brent Yorgey
> On Fri, Jul
On Fri, Jul 06, 2012 at 03:17:54PM -0300, Felipe Almeida Lessa wrote:
> On Fri, Jul 6, 2012 at 2:11 PM, Sebastián Krynski wrote:
> > As I was using predicates (a -> bool) , it appeared the need for combining
> > them with a boolean operator (bool -> bool -> bool) in order to get a new
> > predica
On Fri, Jul 6, 2012 at 2:11 PM, Sebastián Krynski wrote:
> As I was using predicates (a -> bool) , it appeared the need for combining
> them with a boolean operator (bool -> bool -> bool) in order to get a new
> predicate
> combining the previous two. So I wrote my function combinerPred (see code
As I was using predicates (a -> bool) , it appeared the need for combining
them with a boolean operator (bool -> bool -> bool) in order to get a new
predicate
combining the previous two. So I wrote my function combinerPred (see code
below). While I think this is JUST ok, i'm feeling a monad in the