4 ms·
There is no special syntax for partial application because in Haskell partial application is always possible. You can call the function foo :: a -> b -> c
by o1iver 15y ago
There is no special syntax for partial application because in Haskell partial application is always possible.
You can call the function
foo :: a -> b -> c
like this
bar = foo a
or like this:
bar = foo a b.
In the first case bar will be a partially applied function of type
bar :: b -> c
and in the second case it will simply be a value of type c.
Actually, as far as I know, this is actually what happens in the background. I mean that calling
bar = foo a b
actually gets converted to
bar = (foo a) b.
- chromatic 15y agoThere is no special syntax for partial application because in Haskell partial application is always possible. I am aware of this. This is the source of some of my frustration reading Haskell code. I know that you can think of functions as single-arity first-class entities, but I've never been a mathematician and I've never thought that way. I don't have enough experience maintaining large Haskell programs over a long period of time to know, but I suspect that this layering approach might encourage the kind of convolution you occasionally find in CL or Smalltalk programs where it's easy to build a teetering tower of the wrong abstractions. Perhaps there's something different about Haskell that encourages a more careful code curation, but I don't know. Alternately, perhaps it's just a flaw in the way I think about Haskell that I want a visual distinction between partial application and calling a function.