[Haskell-beginners] Making sense of currying in the context of the Hask Category
Brent Yorgey
byorgey at seas.upenn.edu
Fri Sep 28 13:46:53 CEST 2012
On Thu, Sep 27, 2012 at 10:07:53PM -0400, Lino Rosa wrote:
> Hi,
>
> I'm a Haskell newbie and I couldn't quite make sense of how currying
> maps to the the Hask Category.
> How would I map, for instance (+) to a Hask 'arrow'?
Type class polymorphism complicates matters, so for the moment let's
pretend (+) works only on Int. Then (+) is an arrow from the object
Int to the object (Int -> Int).
(+) :: Int -> (Int -> Int)
Hask is special in its ability to have *objects* which themselves
represent arrows, like (Int -> Int). In category theory terms, it is
"cartesian closed".
> If objects are types on Hask, then would a -> a -> a be the first
> object on this chain?
No, the first object is just Int (or 'a') and the second is (Int ->
Int).
> In that case, for the first arrow, would I have as many arrows as
> there are possible partial applications on this type? In other words,
> would I have (+) 1, (+) 2, (+) 3 ... all those transitioning to the
> second object ( a -> a )
> Or, do I have ONE arrow only, like (+) a ?
(+) 1, (+) 2, (+) 3, etc. are all different arrows. They all go from
the object Int to itself.
-Brent
More information about the Beginners
mailing list