[Haskell-cafe] code review?
qdunkan at gmail.com
Tue May 24 08:05:13 CEST 2011
On Mon, May 23, 2011 at 12:02 PM, Neil Mitchell <ndmitchell at gmail.com> wrote:
>> 'if all == False then return False else return True' is a pretty
>> confusing way to say 'return all'. In fact, any time you see 'x ==
>> True' you can just remove the '== True'. The whole postAll thing
>> would be clearer as
> Before doing a code review I always demand that the author runs over
> the code with HLint (http://community.haskell.org/~ndm/hlint) - they
Very good point. In fact you just inspired me to finally download it
and run it on my own code. Thanks for the great tool!
While I'm on the topic, I recently wrote a tool that wanted to
traverse deep data structures as produced by haskell-src-exts. I
wound up with about 50 lines of case expressions and around the time
my hands were literally beginning to hurt decided that enough was
enough and I should try a generic approach. I heard uniplate was
pretty easy to use, and was pretty pleased to turn the entire thing
into a single line. It took me a little longer to figure out I needed
to use universeBi since all the examples were monotyped, but once I
did it Just Worked. Amazing. So thanks again! And maybe you could
mention universeBi in the instant introduction?
More information about the Haskell-Cafe