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
> 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 beauti
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 th
>> 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 tha
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
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
_
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 wr
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 G
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 ad
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
http://www.haskell.org/mailman/lis
On Mon, 2009-01-12 at 20:23 +0100, Bas van Dijk wrote:
> On Mon, Jan 12, 2009 at 6:06 PM, Robin Green 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 non-recur
On Mon, 2009-01-12 at 19:43 +0100, Bas van Dijk wrote:
> On Mon, Jan 12, 2009 at 6:47 PM, Max Bolingbroke
> 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 n
On Mon, Jan 12, 2009 at 6:06 PM, Robin Green 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.
a_
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
___
On Mon, 12 Jan 2009 19:43:00 +0100
"Bas van Dijk" wrote:
> On Mon, Jan 12, 2009 at 6:47 PM, Max Bolingbroke
> 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 sti
On Jan 12, 2009, at 12:47 PM, Max Bolingbroke wrote:
2009/1/12 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.
Then the map can be inlined at the call site and the 'f' i
On Mon, Jan 12, 2009 at 6:47 PM, Max Bolingbroke
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
> indications are that it decrea
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
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
2009/1/12 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.
>>
>>
>>
>> Then the map can be inlined at the call site and the 'f' inlined into
>> the body of 'go'.
>
> This
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
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' inlin
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 c
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
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 ->
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:
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 fr
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
wrote:
>
> 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 t
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-i
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
> s
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: c
31 matches
Mail list logo