Re: [Haskell-cafe] combining predicates, noob question

2012-07-09 Thread Paolino
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

Re: [Haskell-cafe] combining predicates, noob question

2012-07-09 Thread Brent Yorgey
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

Re: [Haskell-cafe] combining predicates, noob question

2012-07-07 Thread Sebastián Krynski
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

Re: [Haskell-cafe] combining predicates, noob question

2012-07-06 Thread Brent Yorgey
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

Re: [Haskell-cafe] combining predicates, noob question

2012-07-06 Thread Felipe Almeida Lessa
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

[Haskell-cafe] combining predicates, noob question

2012-07-06 Thread Sebastián Krynski
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