Commit

98391f7

nice blog! i found that post on curried functions quite interesting. i wonder if you'd be able to get nicer partial application if you use function overloading
ts
function multiply(x: number): (y: number) => number;
function multiply(x: number, y: number): number;
function multiply(x: number, y?: number) {
    if (!y) return (y: number) => x * y;
    return x * y;
}

const double = multiply(2);
const prod = multiply(2, 10);
console.log(prod === double(10));
of course, depending on what you're doing those if statements might get really annoying to manage, but you really only have to do it once. otherwise the syntax for a one-off function call would get annoying i think
ts
multiply(2)(10)
which haskell and other functional languages can get away with because they dont do parentheses for function arguments
haskell
multiply :: Int -> Int -> Int
multiply x y = x * y
double :: Int -> Int
double = multiply 2

main = do
  print (double 10)
  print (multiply 2 10)
p.s. no syntax highlighting for haskell? D:

commit 98391f7

thanks so much for your kind words! I actually have 2 follow up posts on function composition that i'm actively editing right now and 1 of them goes into details of using overloads. here is a sneak peek of a snippet from my "Strongly Typed Variadic Functions in TypeScript"…