Hi >> No because the current definition are recursive and ghc cannot inline >> recursive functions. > >> map :: (a -> b) -> [a] -> [b] >> map f = go >> where >> 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 prettier, and only in a few cases does it try for faster (mapM -> mapM_), but even there its more about avoiding a space leak. Thanks Neil * Of course, HLint (and me) should probably add the disclaimer that the chances of that working your code as it stands are fairly close to 0 - but the ideas and initial research has been started! _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe