Re: [Haskell-cafe] Another point-free question (>>=, join, ap)

2009-02-14 Thread Edsko de Vries
Hi Conor, > Will this do? > > http://www.haskell.org/haskellwiki/Idiom_brackets > > You get to write > > iI f a1 a2 a3 Ji > > for > > do x1 <- a1 > x2 <- a2 > x3 <- a3 > f a1 a2 a3 > > amongst other things... Cool :-) I had seen those idiom brackets before and put them

Re: [Haskell-cafe] Another point-free question (>>=, join, ap)

2009-02-14 Thread Edsko de Vries
On Fri, Feb 13, 2009 at 05:21:50PM +0100, Thomas Davie wrote: > > >Hey, > > > >Thanks for all the suggestions. I was hoping that there was some > >uniform > >pattern that would extend to n arguments (rather than having to use > >liftM2, litM3, etc. or have different 'application' operators in

Re: [Haskell-cafe] Another point-free question (>>=, join, ap)

2009-02-13 Thread Thomas Davie
Hey, Thanks for all the suggestions. I was hoping that there was some uniform pattern that would extend to n arguments (rather than having to use liftM2, litM3, etc. or have different 'application' operators in between the different arguments); perhaps not. Oh well :) Sure you can! Wha

Re: [Haskell-cafe] Another point-free question (>>=, join, ap)

2009-02-13 Thread Conor McBride
Hi Edsko On 13 Feb 2009, at 09:14, Edsko de Vries wrote: Hey, Thanks for all the suggestions. I was hoping that there was some uniform pattern that would extend to n arguments (rather than having to use liftM2, litM3, etc. or have different 'application' operators in between the differen

Re: [Haskell-cafe] Another point-free question (>>=, join, ap)

2009-02-13 Thread Edsko de Vries
Hey, Thanks for all the suggestions. I was hoping that there was some uniform pattern that would extend to n arguments (rather than having to use liftM2, litM3, etc. or have different 'application' operators in between the different arguments); perhaps not. Oh well :) Thanks again! Edsko ___

Re: [Haskell-cafe] Another point-free question (>>=, join, ap)

2009-02-12 Thread Jeremy Shaw
oops, I take that back. It only appears to work if you are sloppy: x :: (Monad m) => m a x = undefined y :: (Monad m) => m b y = undefined g :: (Monad m) => a -> b -> m c g = undefined ex1 :: (Monad m) :: m c ex1 = (g =<< x) =<< y But, if you try to pin down the types you find it only works be

Re: [Haskell-cafe] Another point-free question (>>=, join, ap)

2009-02-12 Thread Jonathan Cast
On Thu, 2009-02-12 at 23:36 +, Edsko de Vries wrote: > Hi, > > I can desugar > > do x' <- x > f x' > > as > > x >>= \x -> f x' > > which is clearly the same as > > x >>= f > > However, now consider > > do x' <- x > y' <- y > f x' y' > > desugared, this is > >

Re: [Haskell-cafe] Another point-free question (>>=, join, ap)

2009-02-12 Thread Jeremy Shaw
Hello, You could do: (f =<< x) =<< y ? - jeremy At Thu, 12 Feb 2009 23:36:19 +, Edsko de Vries wrote: > > Hi, > > I can desugar > > do x' <- x > f x' > > as > > x >>= \x -> f x' > > which is clearly the same as > > x >>= f > > However, now consider > > do x' <- x

Re: [Haskell-cafe] Another point-free question (>>=, join, ap)

2009-02-12 Thread Andrew Wagner
Check out liftM2. It's almost what you want. On Thu, Feb 12, 2009 at 6:36 PM, Edsko de Vries wrote: > Hi, > > I can desugar > > do x' <- x > f x' > > as > > x >>= \x -> f x' > > which is clearly the same as > > x >>= f > > However, now consider > > do x' <- x > y' <- y > f x' y'

[Haskell-cafe] Another point-free question (>>=, join, ap)

2009-02-12 Thread Edsko de Vries
Hi, I can desugar do x' <- x f x' as x >>= \x -> f x' which is clearly the same as x >>= f However, now consider do x' <- x y' <- y f x' y' desugared, this is x >>= \x -> y >>= \y' -> f x' y' I can simplify the second half to x >>= \x -> y >>= f x' but now w