[Haskell-beginners] The Missing Arrow Function Strikes Back
Adrian May
adrian.alexander.may at gmail.com
Wed Jun 5 16:46:10 CEST 2013
Well I just read this:
http://www.haskell.org/haskellwiki/Arrow_tutorial
Adrian.
On 5 June 2013 21:58, Brent Yorgey <byorgey at seas.upenn.edu> wrote:
> What are the types of 'split' and 'unsplit'? It is hard to guess what
> you want just from their names.
>
> -Brent
>
> On Wed, Jun 05, 2013 at 01:02:40PM +0800, Adrian May wrote:
> > 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" <es at ertes.de> wrote:
> >
> > > Adrian May <adrian.alexander.may at gmail.com> 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
> > > Beginners at haskell.org
> > > http://www.haskell.org/mailman/listinfo/beginners
> > >
> > >
>
> > _______________________________________________
> > Beginners mailing list
> > Beginners at haskell.org
> > http://www.haskell.org/mailman/listinfo/beginners
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130605/2afedfeb/attachment-0001.htm>
More information about the Beginners
mailing list