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

Allow underscore to indicate an unused value #2

Closed
Feliix42 opened this issue May 11, 2018 · 2 comments
Closed

Allow underscore to indicate an unused value #2

Feliix42 opened this issue May 11, 2018 · 2 comments

Comments

@Feliix42
Copy link
Member

In Rust (and in Haskell as well?) you write something like

let (foo, _) = fancy_func();

to denote the deconstruction of a tuple while only retaining the first element. We might want to introduce this functionality some time in the future, too (doesn't need to be implemented right away).

@sertel
Copy link

sertel commented May 11, 2018

I wonder why this would currently not work because technically "_" is just a variable name that is just not used elsewhere in the code. Do you see parse errors when doing this?

@Feliix42
Copy link
Member Author

Yep, this is what I get:

ohuac: lexical error at line 7, column 18
CallStack (from HasCallStack):
  error, called at .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Ohua/Compat/Clike/Parser.hs:1029:22 in alang-clike-parser-0.1.0.0-C1uIemENDrx9pCAqtHgztK:Ohua.Compat.Clike.Parser

Line 7, column 18 is _.

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