[Haskell-cafe] ANN: HLint 1.2

Neil Mitchell ndmitchell at gmail.com
Thu Jan 15 12:02:56 EST 2009


> Are you sure that you can't come up with some nice functions like 'maybe' to
> replace those view patterns by function calls? Did you really try? I
> remember the recent discussion on pattern combinators here on Haskell Cafe.

I could, but it would look more ugly - and I want my code to be beautiful :-)

For HLint, view-patterns are something I could live without, SYB is
something I couldn't live without. SYB makes me GHC only,
view-patterns make me GHC 6.10 only. I could port it to GHC 6.8.3, but
I don't think its worth the effort, and the complication that would
ensue. In general a view-pattern, as used in HLint, can be translated
away by:

foo (view -> RHS) ... = ...

foo new_var ... | RHS <- view new_var = ...

But its more ugly, requires more intermediate variables,  isn't as
clear and isn't a generally correct translation (but I think it would
almost always work in HLint).

Thanks

Neil


More information about the Haskell-Cafe mailing list