Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surround operators with parens when pretty-printing #60

Closed
brendanzab opened this issue Jul 23, 2016 · 2 comments
Closed

Surround operators with parens when pretty-printing #60

brendanzab opened this issue Jul 23, 2016 · 2 comments
Milestone

Comments

@brendanzab
Copy link
Member

For example:

> { (+) = \x y -> "squiggly squiggle" }
<top>:Line: 1, Column: 1: Expected the following types to be equal
Expected: { +: 1476 -> 1477 -> String }
Found: { ord: std.prelude.Ord 1479, +: 1479 -> 1479 -> 1479, -: 1479 -> 1479 -> 1479, *: 1479 -> 1479 -> 1479, /: 1479 -> 1479 -> 1479, negate: 1479 -> 1479 }
1 errors were found during unification:
Types do not match:
    Expected: { +: 1476 -> 1477 -> String }
    Found: { ord: std.prelude.Ord 1479, +: 1479 -> 1479 -> 1479, -: 1479 -> 1479 -> 1479, *: 1479 -> 1479 -> 1479, /: 1479 -> 1479 -> 1479, negate: 1479 -> 1479 }
{ (+) = \x y -> "squiggly squiggle" }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@brendanzab
Copy link
Member Author

I'm wondering how we might recover the fact that a function (or type?) should be treated as an operator... should we base it off the characters contained in the identifier, or would it be worth storing a flag somewhere?

@Marwes
Copy link
Member

Marwes commented Jul 23, 2016

There should be function in the lexer.rs which determines if a character is an operator or not. Should be fine to just use that on the first character.

@Marwes Marwes added this to the 0.2 milestone Aug 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants