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

Trouble with infix operators #16

Closed
Ingo60 opened this issue Dec 9, 2014 · 2 comments
Closed

Trouble with infix operators #16

Ingo60 opened this issue Dec 9, 2014 · 2 comments

Comments

@Ingo60
Copy link
Member

Ingo60 commented Dec 9, 2014

Here is todays session:

ingo@ibinti:~/Frege/frege$ repl
Welcome to Frege 3.21.586-g026e8d7 (Oracle Corporation OpenJDK Server VM, 1.7.0_65)

frege> (x³) = x^3   -- gives a reasonable answer
[ERROR: 3]: unexpected '³' while trying to parse unary expression

frege> infix 1 `³`    -- oops, forgot the infix

frege> (x³) = x^3   -- yay! now it works
function ³ :: Num α => α -> α

frege> (3³)         -- what is 3 cubed?
[ERROR: 4]: unexpected '}' while trying to parse left hand side of a
function or pattern binding
[ERROR: 4]: syntax error on end of file

frege> id (3³)      -- avoid ( at beginning  
[ERROR: 4]: unexpected '}' while trying to parse left hand side of a
function or pattern binding
[ERROR: 4]: syntax error on end of file

frege> map (³) [1..10]  
[ERROR: 4]: unexpected '}' while trying to parse left hand side of a
function or pattern binding
[ERROR: 4]: syntax error on end of file

frege> map (`³`) [1..10]     -- works, but ...
[1,8,27,64,125,216,343,512,729,1000]

Turns out the repl doesn't like the new operator at all - except, for what reason ever, when defining (x³)
If I reuse a prelude operator, like ~ this all does work fine.

Note: operator recognition and parsing will be different from 3.22.xxx on, so if this is not a simple fix, just let it be how it is.

@mmhelloworld
Copy link
Member

Thanks Ingo for reporting this bug with detailed information. I have now fixed this issue.

Both the command line REPL and the online REPL are updated and released / deployed.

@Ingo60
Copy link
Member Author

Ingo60 commented Dec 12, 2014

Thanks for fixing in such a short time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants