I recently installed the Haskell Eclipse-plugin "EclipseFP". Everything works pretty well while there's one feature which makes me very angry hehe. I cannot reduce the warning level of the output. Eclipse/It's plugin seems to auto-append the "-Wall" flag, which is very very sensitive against type-things. Let's show this on an example:
*Main> head [1,2,3]
<interactive>:1:11:
Warning: Defaulting the following constraint(s) to type `Integer'
(Num a0) arising from the literal `3'
In the expression: 3
In the first argument of `head', namely `[1, 2, 3]'
In the expression: head [1, 2, 3]
<interactive>:1:11:
Warning: Defaulting the following constraint(s) to type `Integer'
(Num a0) arising from the literal `3' at <interactive>:1:11
(Show a0) arising from a use of `print' at <interactive>:1:1-12
In the expression: 3
In the first argument of `head', namely `[1, 2, 3]'
In the expression: head [1, 2, 3]
1
*Main>
Yep, that is REALLY annoying. It's caused by "intrinsic" functions as well as on custom ones. Another one:
factorial :: (Integral a) => a -> a
factorial 1 = 1
factorial n = n * factorial (n-1)
*Main> factorial 3
<interactive>:1:1:
Warning: Defaulting the following constraint(s) to type `Integer'
(Integral a0) arising from a use of `factorial'
at <interactive>:1:1-9
(Num a0) arising from the literal `3' at <interactive>:1:11
In the expression: factorial 3
In an equation for `it': it = factorial 3
<interactive>:1:1:
Warning: Defaulting the following constraint(s) to type `Integer'
(Integral a0) arising from a use of `factorial'
at <interactive>:1:1-9
(Num a0) arising from the literal `3' at <interactive>:1:11
(Show a0) arising from a use of `print' at <interactive>:1:1-11
In the expression: factorial 3
In an equation for `it': it = factorial 3
6
*Main>
I don't know about Eclipse, but you can off warnings in your .ghci
file. Put
:set -Wall -- unnecessary if Eclipse already turns it on
:set -fno-warn-type-defaults
:set -fno-warn-unused-do-bind
and whatever else you don't want to warned about by default into your ~/.ghci
and reduce the warnings to the important ones. If you want to load some modules by default, you can also add import Control.Applicative
(or whichever).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With