<div class="gmail_quote">On Fri, Apr 9, 2010 at 6:44 AM, Ivan Lazar Miljenovic <span dir="ltr"><<a href="mailto:ivan.miljenovic@gmail.com">ivan.miljenovic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
As of 6.12.1, the new -fwarn-unused-do-bind warning is activated with<br>
-Wall. This is based off a bug report by Neil Mitchell:<br>
<a href="http://hackage.haskell.org/trac/ghc/ticket/3263" target="_blank">http://hackage.haskell.org/trac/ghc/ticket/3263</a> .<br>
<br>
However, does it make sense for this to be turned on with -Wall?</blockquote><div><br></div><div>Personally, I find it to be tremendously noisy and unhelpful, and I always edit my .cabal files to turn it off. I think of it as a usability regression.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> For<br>
starters, why should this warning apply only to do blocks and not to<br>
explicit usage of >>, etc.? That is, the following code (as specified<br>
in the above bug report) generates an error:<br>
<br>
do doesFileExist "foo"<br>
return 1<br>
<br>
yet this doesn't:<br>
<br>
doesFileExist "foo" >> return 1<br>
<br>
If monadic code is going to return an error, then shouldn't _all_<br>
monadic code do so, and not just those in do blocks?<br>
<br>
Secondly, a fair number of packages seem to be disabling this globally;<br>
the packages I know of (from mentions on mailing lists and grepping on<br>
/srv/code/*/*.cabal on <a href="http://code.haskell.org" target="_blank">code.haskell.org</a>) that have the<br>
-fno-warn-unused-do-bind option being passed to GHC in their .cabal file<br>
include:<br>
<br>
* HsOpenCL<br>
* leksah-server<br>
* xmonad (including xmonad-contrib)<br>
* xmobar<br>
* pandoc<br>
<br>
My reason for bringing this up is that I'm soon about to release a new<br>
version of my graphviz library, and am debating what to do. Note that<br>
most of these errors are being caused by usage of a monadic-style of<br>
parsing (before anyone tells me I should be using an Applicative style<br>
instead, polyparse doesn't support Applicative, so I can't) and as such<br>
the "return value" is being evaluated anyway. The way I see it, I have<br>
4 options:<br>
<br>
1. Do as the error suggests and preface usage of these parser<br>
combinators with "_ <-".<br>
<br>
2. Use some function of type "(Monad m) => m a -> m ()" instead of doing<br>
"_ <-".<br>
<br>
3. Duplicate the parser combinators in question so that I have one<br>
version that returns a value and another that does the main parser<br>
and then returns (); then use this second combinator in do blocks<br>
where I don't care about the returned value.<br>
<br>
4. Put "-fno-warn-unused-do-bind" in the .cabal file.<br>
<br>
The first two options don't appeal to me as being excessive usage of<br>
boilerplate; the third involves too much code duplication. However, I<br>
am loath to just go and disable a warning globally.<br>
<br>
What does the Haskell community think? Is -fwarn-unused-do-bind a<br>
worthwhile warning (and code should be updated so as not to cause it to<br>
find anything to warn about)? Or is it more of a hindrance to be<br>
disabled?<br>
<font color="#888888"><br>
--<br>
</font><div class="im">Ivan Lazar Miljenovic<br>
<a href="mailto:Ivan.Miljenovic@gmail.com">Ivan.Miljenovic@gmail.com</a><br>
<a href="http://IvanMiljenovic.wordpress.com" target="_blank">IvanMiljenovic.wordpress.com</a><br>
_______________________________________________<br>
</div><div><div></div><div class="h5">Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>