hinc icon indicating copy to clipboard operation
hinc copied to clipboard

How can operators be supported?

Open maralorn opened this issue 5 years ago • 1 comments

Preface: Hey, I really like the idea of this and have thought about something like this before myself. Especially the unified block syntax for where, let and do is exactly what I had in mind. (I agree with #5, though.)

(I must admit, that my personal interest in this is less about being appealing to programmers from other languages but about having a clean syntax. So my opinion might not match the project goals.)

Anyways, I feel like trying to write Haskell without operators will be really awkward in practice though. I see that the dot is already kinda captured by the syntax, but I’d really like some way to do function composition. In the example I tried to replace guard(p(x)) with guard(p $ x) but that's not supported, sadly.

maralorn avatar Aug 16 '20 15:08 maralorn

Yes, parsing operators is quite complicated, because you need to know the fixities of all of them, and create a parser around those.

My current state of thought is to simply let names to be symbolic. So you could in principle write:

+(1,2)
1.+(2)

x.<<=((x) => next)

serras avatar Sep 04 '20 15:09 serras