[Haskell-cafe] Puzzled about inlining and specialise inline under ghc -O2

2012-03-22 Thread Rafal Kolanski
Dear Haskell-Cafe, I'm computing a histogram of a bunch of symbols with up to 8 bits of information each, stored in a unboxed vector of Word8. The histogram is represented as an unboxed vector of Int with size 2^bits. I compute the histogram by folding an increment function. The problem:

Re: [Haskell-cafe] Puzzled

2007-10-06 Thread Peter Verswyvelen
Ouch, now I really feel stupid, because I *knew* about the stricter foldl' version. But great to know about the new strictness on vars! I really should get GHC 6.8 RC1 for Windows... I just got puzzled why mysum worked better than sum for some reason... mysym looks like an identical

Re: [Haskell-cafe] Puzzled

2007-10-06 Thread Chaddaï Fouché
2007/10/6, Peter Verswyvelen [EMAIL PROTECTED]: But great to know about the new strictness on vars! I really should get GHC 6.8 RC1 for Windows... Just in case you misunderstood : this functionality was already there in GHC 6.4, it's just the new syntax to active it that is available only in

Re: [Haskell-cafe] Puzzled

2007-10-06 Thread Stuart Cook
On 10/6/07, Bertram Felgenhauer [EMAIL PROTECTED] wrote: This is a language extension, you need -fbang-patterns to allow it, or with a recent ghc (6.7, 6.9 or a 6.8 rc) a {-# LANGUAGE BangPatterns #-} pragma, or -XBangPatterns. LANGUAGE pragmas (including BangPatterns) work just fine in 6.6,

Re: [Haskell-cafe] Puzzled

2007-10-06 Thread Brent Yorgey
Just to be clear, I doubt the difference had anything to do with tail-recursion per se. My guess is that with the mysum version, ghc was able to do some strictness analysis/optimization that it wasn't able to do (for whatever reason) with the first version. The best solution (as others have

[Haskell-cafe] Puzzled

2007-10-05 Thread Peter Verswyvelen
The following code, when compiled with GHC 6.6.1 --make -O gives a stack overflow when I enter 100 as a command line argument: (please don't look at the efficiency of the code, it can of course be improved a lot both in time performance and numeric precision...) import System leibnizPI

Re: [Haskell-cafe] Puzzled

2007-10-05 Thread Bertram Felgenhauer
Peter Verswyvelen wrote: The following code, when compiled with GHC 6.6.1 --make -O gives a stack overflow when I enter 100 as a command line argument: (please don't look at the efficiency of the code, it can of course be improved a lot both in time performance and numeric precision...)

[Haskell-cafe] Puzzled by error with forall quantifier.

2004-02-02 Thread Theodore S. Norvell
Can anyone explain the following error message from Hug98 (with extensions enabled)? I have class Space t class Space t = HasY v t where assignY :: v - t - t getY :: t - v varY :: forall w . Space w = v - (t-t) - (w-w) I get an error on the last definition quantifier does not

Re: [Haskell-cafe] Puzzled by error with forall quantifier.

2004-02-02 Thread Iavor S. Diatchki
hello, just skip the forall. free type variables are implicitly forall-quantified. the forall keyword is used for functions that need to take polymorphic functions as arguments, but that's advanced stuff. so in short, this should work: class Space t class Space t = HasY v t where

Re: [Haskell-cafe] Puzzled by error with forall quantifier.

2004-02-02 Thread Theodore S. Norvell
Iavor S. Diatchki wrote: just skip the forall. free type variables are implicitly forall-quantified. Of course! Thanks. The problem is that I actually wanted exists. However as the type that exists is functionally dependent on other the parameters to the class I think I can deal with it