Skip to content
Discussion options

You must be logged in to vote

This is a good question. I think the rationale is something like the following. Because Haskell is not purely prefix (you can have infix operators like + and * with different precedence), then to parse the textual representation into a syntax tree in an unambigous way needs us to know the types of all the symbols. But to do this, we need the parse tree.

So instead, we define the parsing phase, where the textual representation (the code) is turned into a syntax tree for further analysis with a set of precedence rules. A consequence of the convention for curried functions (that -> is right-associative) is that we want left-associative function application. Hence when parsing (and we don't k…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tomhepz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants