diprism / perpl

The PERPL Compiler
MIT License
10 stars 5 forks source link

Currying notation #26

Closed davidweichiang closed 2 years ago

davidweichiang commented 2 years ago

I just noticed that the compiler allows you to write \x:a,y:b.e for \x:a.\y:b.e. Is that right, and why is that?

colin-mcd commented 2 years ago

Yes that is right. That was a parsing decision I made very early on and I don't have a strong opinion on. I eventually planned (and still plan, I think) to have bidirectional type-checking, so that in most situations you wouldn't have to type-annotate lambdas (\ a. ... instead of \ a : A. ...). I figured it'd be nice if we could just combine the lambdas so that you don't have to write \ a. \ b. \ c. ... and could instead write the Haskell-like syntax \ a b c. .... But then if you did need or want to type-annotate any of the lambdas it would be annoying, so I added commas to allow for parsing things like \ a, b : B, c. .... I'm not sure that this would actually be very helpful, so if you think we should just do \ a. \ b. \ c. ... or \ a b c. ..., we can just switch to that.

davidweichiang commented 2 years ago

I think I'm ok with \a b c or \a. \b. \c. (or define f a b c) but I find the commas strange (makes me think of a tuple).