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
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
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
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
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
___
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
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
>
>
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
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'
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
10 matches
Mail list logo