Re: [Haskell-cafe] ANN: HLint 1.2

2009-02-07 Thread Henning Thielemann
On Mon, 12 Jan 2009, Duncan Coutts wrote: On Mon, 2009-01-12 at 15:06 +0100, Henning Thielemann wrote: It has to be manually transformed into a version that is not recursive at the top level: map :: (a - b) - [a] - [b] map f = go where go [] = [] go (x:xs) = f x : go xs Then

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-15 Thread Henning Thielemann
On Sun, 11 Jan 2009, Neil Mitchell wrote: I am pleased to announce HLint version 1.2. HLint is a lint-like tool for Haskell that detects and suggests improvements for your code. HLint is compatible with most GHC extensions, and supports a wide variety of suggestions, and can be extended with

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-15 Thread Neil Mitchell
Hi Henning, To install: cabal update cabal install hlint Fails for me, because of the base-4 dependency. - I'm still using GHC-6.8.2. Can HLint suggest view-pattern-free expressions, such that the program also runs on GHC-6.8 ? :-) HLint is written using view-patterns so requires GHC 6.10

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-15 Thread Henning Thielemann
On Thu, 15 Jan 2009, Neil Mitchell wrote: Hi Henning, To install: cabal update cabal install hlint Fails for me, because of the base-4 dependency. - I'm still using GHC-6.8.2. Can HLint suggest view-pattern-free expressions, such that the program also runs on GHC-6.8 ? :-) HLint is

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-15 Thread Neil Mitchell
Hi My question was, whether HLint can help translating HLint to code without view patterns. Ah, I misunderstood. Yes, it could (in theory), but it can't automatically apply the hints it generates. Upgrading to GHC 6.10 is probably easier :-) Thanks Neil

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-15 Thread Henning Thielemann
On Thu, 15 Jan 2009, Neil Mitchell wrote: Hi My question was, whether HLint can help translating HLint to code without view patterns. Ah, I misunderstood. Yes, it could (in theory), but it can't automatically apply the hints it generates. Upgrading to GHC 6.10 is probably easier :-) Also

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-15 Thread Neil Mitchell
Ah, I misunderstood. Yes, it could (in theory), but it can't automatically apply the hints it generates. Upgrading to GHC 6.10 is probably easier :-) Also throwing away Hugs ... (YHC too ?) Yes :-( I normally develop in Hugs, for a change I wanted to try GHCi. It's also a project that has

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-15 Thread Henning Thielemann
On Thu, 15 Jan 2009, Neil Mitchell wrote: I normally develop in Hugs, for a change I wanted to try GHCi. It's also a project that has loads of pattern matching at a fairly complex level, so the benefits offered by view-patterns and pattern-guards were just too hard to pass up. Are you sure

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-15 Thread Neil Mitchell
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

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-14 Thread Andrew Coppin
Neil Mitchell wrote: I can't really be blamed for making mistakes before HLint ;-) Don't worry - self-programming computers are just around the corner... ;-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Neil Mitchell
Hi Does GHC specialize map? If it doesn't, then hand crafted version could be faster. GHC doesn't specialize map, and a hand-crafted one could be faster - but you then wouldn't get foldr/build fusion. In general HLint tries to make the code prettier, but sometimes you will need to deviate

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Duncan Coutts
On Mon, 2009-01-12 at 01:02 +0100, Lennart Augustsson wrote: Does GHC specialize map? If it doesn't, then hand crafted version could be faster. No because the current definition are recursive and ghc cannot inline recursive functions. map :: (a - b) - [a] - [b] map _ [] = [] map f (x:xs)

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Henning Thielemann
On Mon, 12 Jan 2009, Duncan Coutts wrote: On Mon, 2009-01-12 at 01:02 +0100, Lennart Augustsson wrote: Does GHC specialize map? If it doesn't, then hand crafted version could be faster. No because the current definition are recursive and ghc cannot inline recursive functions. map :: (a -

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Neil Mitchell
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

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Duncan Coutts
On Mon, 2009-01-12 at 15:06 +0100, Henning Thielemann wrote: It has to be manually transformed into a version that is not recursive at the top level: 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

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Henning Thielemann
On Mon, 12 Jan 2009, Neil Mitchell wrote: 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

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Jan-Willem Maessen
On Jan 12, 2009, at 9:01 AM, Duncan Coutts wrote: No because the current definition are recursive and ghc cannot inline recursive functions. map :: (a - b) - [a] - [b] map _ [] = [] map f (x:xs) = f x : map f xs It has to be manually transformed into a version that is not recursive at

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Max Bolingbroke
2009/1/12 Jan-Willem Maessen jmaes...@alum.mit.edu: On Jan 12, 2009, at 9:01 AM, Duncan Coutts wrote: No because the current definition are recursive and ghc cannot inline recursive functions. Then the map can be inlined at the call site and the 'f' inlined into the body of 'go'.

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Don Stewart
ndmitchell: Hi Does GHC specialize map? If it doesn't, then hand crafted version could be faster. GHC doesn't specialize map, and a hand-crafted one could be faster - but you then wouldn't get foldr/build fusion. In general HLint tries to make the code prettier, but sometimes you will

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Don Stewart
dons: ndmitchell: Hi Does GHC specialize map? If it doesn't, then hand crafted version could be faster. GHC doesn't specialize map, and a hand-crafted one could be faster - but you then wouldn't get foldr/build fusion. In general HLint tries to make the code prettier, but

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Bas van Dijk
On Mon, Jan 12, 2009 at 6:47 PM, Max Bolingbroke batterseapo...@hotmail.com wrote: GHC should indeed be doing so. I'm working (on and off) to work out some suitable heuristics and put the transformation into ghc -O2. There are a few wrinkles that still need sorting out, but preliminary

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Jan-Willem Maessen
On Jan 12, 2009, at 12:47 PM, Max Bolingbroke wrote: 2009/1/12 Jan-Willem Maessen jmaes...@alum.mit.edu: On Jan 12, 2009, at 9:01 AM, Duncan Coutts wrote: No because the current definition are recursive and ghc cannot inline recursive functions. Then the map can be inlined at the

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Robin Green
On Mon, 12 Jan 2009 19:43:00 +0100 Bas van Dijk v.dijk@gmail.com wrote: On Mon, Jan 12, 2009 at 6:47 PM, Max Bolingbroke batterseapo...@hotmail.com wrote: GHC should indeed be doing so. I'm working (on and off) to work out some suitable heuristics and put the transformation into ghc

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Henning Thielemann
On Mon, 12 Jan 2009, Robin Green wrote: I tend to use Control.Monad.Fix.fix (which actually has nothing to do with monads, despite the package name) That's why it is also available from Data.Function now: http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Function.html

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Bas van Dijk
On Mon, Jan 12, 2009 at 6:06 PM, Robin Green gree...@greenrd.org wrote: The fix-style equivalent to your repeat above, would be something like this: repeat x = fix $ \me - x ::: me Interesting. Your repeat and mine are compiled to the same code: Data.Stream.repeat :: forall a_aVi.

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Derek Elkins
On Mon, 2009-01-12 at 19:43 +0100, Bas van Dijk wrote: On Mon, Jan 12, 2009 at 6:47 PM, Max Bolingbroke batterseapo...@hotmail.com wrote: GHC should indeed be doing so. I'm working (on and off) to work out some suitable heuristics and put the transformation into ghc -O2. There are a few

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Derek Elkins
On Mon, 2009-01-12 at 20:23 +0100, Bas van Dijk wrote: On Mon, Jan 12, 2009 at 6:06 PM, Robin Green gree...@greenrd.org wrote: The fix-style equivalent to your repeat above, would be something like this: repeat x = fix $ \me - x ::: me Interesting. The definition of fix is small and

[Haskell-cafe] ANN: HLint 1.2

2009-01-11 Thread Neil Mitchell
Hi, I am pleased to announce HLint version 1.2. HLint is a lint-like tool for Haskell that detects and suggests improvements for your code. HLint is compatible with most GHC extensions, and supports a wide variety of suggestions, and can be extended with additional user suggestions. To install:

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-11 Thread Don Stewart
ndmitchell: Hi, I am pleased to announce HLint version 1.2. HLint is a lint-like tool for Haskell that detects and suggests improvements for your code. HLint is compatible with most GHC extensions, and supports a wide variety of suggestions, and can be extended with additional user

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-11 Thread Henning Thielemann
On Sun, 11 Jan 2009, Neil Mitchell wrote: HLint will automatically detect if you should have used a map, a foldr or a foldl and suggest how to change your code. In the GHC, darcs and Hoogle code bases there are no obvious map-like functions, which is a good sign :-) I found so many 'map'

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-11 Thread Lennart Augustsson
Does GHC specialize map? If it doesn't, then hand crafted version could be faster. On Sun, Jan 11, 2009 at 11:44 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Sun, 11 Jan 2009, Neil Mitchell wrote: HLint will automatically detect if you should have used a map, a foldr or a