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
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to