Haskell Platform Proposal: HLint

Neil Mitchell ndmitchell at gmail.com
Wed Nov 24 19:42:02 EST 2010


>> If you aren't using a boilerplate removal library, and are working
>> with haskell-src-exts, then you are very probably doing it wrong!
>
> Oh?  Why is that?

By wrong I don't mean "incorrect results", I mean hideously ugly. Take
the example of stripping out all type signatures in patterns, since
you want to get rid of that extension. Without a boilerplate removal
library that would take ~100 lines of code, perhaps more, and be very
sensitive to which extensions your parser supported. With Uniplate I
can write:

import Data.Generics.Uniplate.Data
removePatternSigs = transformBi f
   where
        f (PatTypeSig _ x _) = x
        f x = x

If I didn't use Uniplate, I'd find the extra syntax extensions in HSE
to be very annoying. Since I do use Uniplate, I only need to think
about them when I'm working with them - so I transparently support
them, and when I do need them, they're already there. I'm using
Uniplate as an example since I think it's the nicest boilerplate
removal library, but I'm biased, and any boilerplate removal library
should be able to do similar tricks.

Thanks, Neil


More information about the Libraries mailing list