Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  The Missing Arrow Function Strikes Back (Adrian May)
   2. Re:  The Missing Arrow Function Strikes Back (Ertugrul S?ylemez)
   3. Re:  The Missing Arrow Function Strikes Back (Adrian May)


----------------------------------------------------------------------

Message: 1
Date: Wed, 5 Jun 2013 12:30:26 +0800
From: Adrian May <[email protected]>
Subject: [Haskell-beginners] The Missing Arrow Function Strikes Back
To: "[email protected]" <[email protected]>
Message-ID:
        <cad-ubzec8eypygwm6f9e0t3otu8wgsfzw_jnhetepxozza3...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi All,

I just banged up against this problem:

http://haskell.1045720.n5.nabble.com/The-case-of-the-missing-Arrow-function-td3125388.html

Was liftA2 (not the applicative one) a bad idea, or is there another way to
do it, or what?

TIA,
Adrian.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130605/1d298aa6/attachment-0001.htm>

------------------------------

Message: 2
Date: Wed, 5 Jun 2013 06:55:11 +0200
From: Ertugrul S?ylemez <[email protected]>
Subject: Re: [Haskell-beginners] The Missing Arrow Function Strikes
        Back
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

Adrian May <[email protected]> wrote:

> I just banged up against this problem:
>
> http://haskell.1045720.n5.nabble.com/The-case-of-the-missing-Arrow-function-td3125388.html
>
> Was liftA2 (not the applicative one) a bad idea, or is there another
> way to do it, or what?

That liftA2 (let me call it liftA2') likely has this type signature:

    liftA2' :: (Arrow cat)
               => (b -> c -> d)
               -> cat a b
               -> cat a c
               -> cat a d

Does this sound familiar?  You can write this function in terms of the
arrow combinators:

    liftA2' f c d = arr (uncurry f) . (c &&& d)

However, if your arrow is also a family of applicative functors
(i.e. pretty much always),

    instance Applicative (MyArrow a)

then it's probably a bad idea, because you really want to use the
cleaner liftA2 instead:

    liftA2 :: (Applicative f)
              => (a -> b -> c)
              -> f a
              -> f b
              -> f c


Greets,
Ertugrul

-- 
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130605/0aae8d44/attachment-0001.pgp>

------------------------------

Message: 3
Date: Wed, 5 Jun 2013 13:02:40 +0800
From: Adrian May <[email protected]>
Subject: Re: [Haskell-beginners] The Missing Arrow Function Strikes
        Back
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Message-ID:
        <cad-ubzfgv-d2mojvbzt5wpc8bo1by8bix-tdchsuty-utbj...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Thanks Ertugrul. In the meantime I noticed that split and unsplit are also
missing. Is there a similar replacement for them?

Adrian.
 On 5 Jun 2013 12:57, "Ertugrul S?ylemez" <[email protected]> wrote:

> Adrian May <[email protected]> wrote:
>
> > I just banged up against this problem:
> >
> >
> http://haskell.1045720.n5.nabble.com/The-case-of-the-missing-Arrow-function-td3125388.html
> >
> > Was liftA2 (not the applicative one) a bad idea, or is there another
> > way to do it, or what?
>
> That liftA2 (let me call it liftA2') likely has this type signature:
>
>     liftA2' :: (Arrow cat)
>                => (b -> c -> d)
>                -> cat a b
>                -> cat a c
>                -> cat a d
>
> Does this sound familiar?  You can write this function in terms of the
> arrow combinators:
>
>     liftA2' f c d = arr (uncurry f) . (c &&& d)
>
> However, if your arrow is also a family of applicative functors
> (i.e. pretty much always),
>
>     instance Applicative (MyArrow a)
>
> then it's probably a bad idea, because you really want to use the
> cleaner liftA2 instead:
>
>     liftA2 :: (Applicative f)
>               => (a -> b -> c)
>               -> f a
>               -> f b
>               -> f c
>
>
> Greets,
> Ertugrul
>
> --
> Not to be or to be and (not to be or to be and (not to be or to be and
> (not to be or to be and ... that is the list monad.
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130605/7a2d2667/attachment-0001.htm>

------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 60, Issue 6
****************************************

Reply via email to