[Haskell-cafe] ANN: HLint 1.2
lemming at henning-thielemann.de
Mon Jan 12 09:58:27 EST 2009
On Mon, 12 Jan 2009, Neil Mitchell wrote:
>>> No because the current definition are recursive and ghc cannot inline
>>> recursive functions.
>>> map :: (a -> b) -> [a] -> [b]
>>> map f = go
>>> go  = 
>>> go (x:xs) = f x : go xs
>>> Then the map can be inlined at the call site and the 'f' inlined into
>>> the body of 'go'.
>> Maybe HLint can make such suggestions ...
> HLint would probably just suggest you use a supercompiler*, for which
> specialisation such as this is easy
> (http://www.cs.york.ac.uk/~ndm/supero). HLint is about making code
Actually, I find the 'go' variant prettier, because it clearly shows that
the 'f' is not "altered" in the recursion.
More information about the Haskell-Cafe