[Haskell-cafe] Maybe a compiler bug?

Peter Verswyvelen bugfact at gmail.com
Tue Jan 6 10:33:20 EST 2009


Exactly. The best you can do is try to reduce your code to a tiny
fragment that still exposes the problem, and report it as a bug.

On Tue, Jan 6, 2009 at 4:52 PM, Murray Gross <mgross21 at verizon.net> wrote:
>
> The issue here is not whether or not the code is pretty or elegant, but
> whether or not I get correct execution of what I have, which is a correct
> statement of what I want (even if not the prettiest or most lint free), and
> I don't. There are lots of ways to work around the problem, but that
> doesn't, unfortunately, make the problem go away, and it is sure to appear
> elsewhere as the program is extended, which it will be.
>
> It would appear that the real issue here is that someone with resources I
> don't have needs to dig into the compilers--it should not be necessary to
> use trial and error to find an alternate writing of code that is legal and
> correct (regardless of the aesthetics) but is incorrectly compiled. For the
> time being, I will use native compilation and hope that someone can find and
> fix the error so that I can use the speed advantage of optimization.
>
> Best,
>
> Murray Gross
>
>
>
> On Tue, 6 Jan 2009, Neil Mitchell wrote:
>
>> Hi
>>
>>> gTst3 right left = if (lr > ll)  then  False else True
>>>                        where lr = length (right ! 2)
>>>                              ll = length (left ! 2)
>>
>> Running this code over HLint (http://www.cs.york.ac.uk/~ndm/hlint) says:
>>
>> Example.hs:8:1: Error: Redundant if
>> Found:
>>  if (lr > ll) then False else True
>> Why not:
>>  not (lr > ll)
>>
>> Making that change and running it again gives:
>>
>> Example.hs:8:1: Error: Use <=
>> Found:
>>  not (lr > ll)
>> Why not:
>>  lr <= ll
>>
>> Which ends up with something similar to what you came up with.
>> However, if we take your final answer:
>>
>>> gTst3 right left = (lr <= ll)
>>>                        where lr = length (right ! 2)
>>>                              ll = length (left ! 2)
>>
>> We get:
>>
>> Example.hs:8:1: Warning: Redundant brackets
>> Found:
>>  (lr <= ll)
>> Why not:
>>  lr <= ll
>>
>> Leaving us with the HLint 1.0 compliant (TM) :
>>
>> gTst3 right left = lr <= ll
>>                        where lr = length (right ! 2)
>>                              ll = length (left ! 2)
>>
>> Thanks
>>
>> Neil
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list