Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

unused values should probably be a warning, not an error #4

Closed
mwotton opened this issue Apr 23, 2010 · 12 comments
Closed

unused values should probably be a warning, not an error #4

mwotton opened this issue Apr 23, 2010 · 12 comments

Comments

@mwotton
Copy link

mwotton commented Apr 23, 2010

if you're developing bottom up, it's very distracting to see it flash red for variables you're not yet using. A warning is fine, but it shouldn't be an outright error.

@kazu-yamamoto
Copy link
Collaborator

Colors dependes on your environment. In my environment, "gray" is used. I don't configure colors at all. I created unused variables and typing "M-?" results in "warning", not "error". If unused variables are categorized to "error" in your environment, please give me example code.

@mwotton
Copy link
Author

mwotton commented Apr 27, 2010

module Foo() where
killer = 10

gives

Line 2: 1 error(s), 2 warning(s)
 Warning: Defined but not used: `killer'
Warning: Definition but no type signature for `killer'
         Inferred type: killer :: t

Warning: Defaulting the following constraint(s) to type `Integer'
         `Num t' arising from the literal `10' at foo.hs:2:9-10
In the expression: 10
In the definition of `killer': killer = 10

@kazu-yamamoto
Copy link
Collaborator

I don't understand your point, sorry. This result seems natural to me. What is your problem?

@mwotton
Copy link
Author

mwotton commented Apr 27, 2010

I'm trying to work out what the error is - it says "Line 2: 1 error, 2 warnings", but there are only two warnings listed, no errors.

@mwotton
Copy link
Author

mwotton commented Apr 27, 2010

Three warnings, I mean:) but no errors.

@kazu-yamamoto
Copy link
Collaborator

OK. I understand.
P.S.
Since I found ghc-mod does not work with GHC 6.12, I'm suffering from this bug now.

http://hackage.haskell.org/trac/ghc/ticket/4015

@mwotton
Copy link
Author

mwotton commented Apr 27, 2010

really? But I don't have any records in that test program...

@kazu-yamamoto
Copy link
Collaborator

Really? What's version of GHC? I'm using GHC 6.12.1.

@mwotton
Copy link
Author

mwotton commented Apr 27, 2010

I'm using 6.12.1 too. The output from ghc-mod actually looks reasonable, I think it's just getting processed somewhere in the elisp.

mwotton@loki:/home/mwotton/projects$ ghc-mod check ./foo.hs
foo.hs:3:0:Warning: Definition but no type signature for `res'         Inferred type: res::t
foo.hs:3:6:Warning: Defaulting the following constraint(s) to type `Integer'         `Num t' arising from the literal `20' at foo.hs:3:6-7In the expression: 20In the definition of `res': res = 20
foo.hs:4:0: Warning: Defined but not used: `killer'
foo.hs:4:0:Warning: Definition but no type signature for `killer'         Inferred type: killer :: t
foo.hs:4:9:Warning: Defaulting the following constraint(s) to type `Integer'         `Num t' arising from the literal `10' at foo.hs:4:9-10In the expression: 10In the definition of `killer': killer = 10
Warning: output was redirected with -o, but no output will be generated

because there is no Main module.

@kazu-yamamoto
Copy link
Collaborator

This bug is relating to "browse" not "check".

@kazu-yamamoto
Copy link
Collaborator

In my environment, 3 warnings are displayed...

@mwotton
Copy link
Author

mwotton commented Apr 30, 2010

right, this looks great now. THanks!

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants