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

Unused warnings #2

Open
finnteegen opened this issue Jan 28, 2021 · 3 comments
Open

Unused warnings #2

finnteegen opened this issue Jan 28, 2021 · 3 comments

Comments

@finnteegen
Copy link
Member

An expression like count = [let { _ = print [i]; i = getLine } in ()] yields a warning that i is unused (which is not the case apparently).

@Ziharrk
Copy link
Member

Ziharrk commented Jan 31, 2021

i is only relevant for the effect and not the actual result (). Should we disable those warnings in the SML plugin completely? Or is it still sensible to warn a user about this?
Maybe we could just try to mark values with type () (e.g. the _ in this case) as always used. That would prevent most insensible warnings, while not removing the warning in sensible cases.

@finnteegen
Copy link
Member Author

I do not have a good answer for that question. Due to the strict evaluation, everything is evaluated at some point, which makes it hard to refer to things as unused. Nevertheless, you are right that these warnings point the programmer to common errors - at least most of the time. In this case, I would argue that i is not unused because it is cleary referenced in another statement. Perhaps marking values of type () is plausible.

@Ziharrk
Copy link
Member

Ziharrk commented Feb 1, 2021

As a reminder

Someone has noticed a related issue in GHC: https://gitlab.haskell.org/ghc/ghc/-/issues/19003

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