[Haskell-beginners] Making sense of currying in the context of the Hask Category
Brent Yorgey
byorgey at seas.upenn.edu
Sat Sep 29 13:09:56 CEST 2012
On Fri, Sep 28, 2012 at 08:53:11PM -0400, Lino Rosa wrote:
> Thanks for the responses :) I've read on cartesian closed categories,
> but I guess I need more time for it to sink in - my knowlege on
> category theory is *very* limited.
>
> Still, continuing on the Int + Int example. Would this be the sequence
> of transformations, then?
You seem quite set on this idea of there being "a sequence of
transformations", I am not sure why. When thinking about (+) there
are many different related arrows; some of them form sequences (can be
composed) and some can't. So this is not necessarily a helpful way of
thinking about things.
> Int -> (Int -> Int) -> Int
> (+) (z) (?)
>
> What do I label the arrow (?) ?
That said, you could label the arrow (?) with something like ($2)
which means "apply a function to the argument 2".
> I understand the first transformation as "function (+) when applied to
> an Int will result in (Int -> Int)". How would I describe function (?)
> similarly ?
> It's almost as it the arrow is z and (?) is the Int and I'm applying z
> to (?), but that makes no sense!
>
> If I understood correctly, 'z' would be a special type, one which when
> applied (?) would return the final Int. This comes Hask being
> cartesian closed. Still I'm clueless on the arrow (?)
I think you actually had it right here. Indeed it does not make sense
for (?) to be an Int, but it can indeed be a function like "apply the
input to the argument 2". Having an "apply" operation is one of the
criteria for being cartesian closed.
-Brent
>
> On Fri, Sep 28, 2012 at 8:07 AM, Kim-Ee Yeoh <ky3 at atamo.com> wrote:
> > Hi Lino,
> >
> > Brent gave an excellent answer. Looking up "cartesian closed category"
> > should yield even more insights.
> >
> > On Fri, Sep 28, 2012 at 9:07 AM, Lino Rosa <lino.aguiar.rosa at gmail.com>
> > wrote:
> >
> >> That's the
> >> function resulting from the previous partial application of (+), but
> >> that fuction only exists at run time, after you apply the first one.
> >
> >
> > When you speak of a function that "only exists at run time", I think you're
> > alluding to partial evaluation. Haskell doesn't do that, although many have
> > wished for it.
> >
> >
> > -- Kim-Ee
> >
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
More information about the Beginners
mailing list