The GHC.PArr module [Was: Re: GHC 6.4 release candidates available]

Peter Eriksen s022018 at student.dtu.dk
Thu Feb 17 13:19:13 EST 2005


Remi Turk <rturk <at> science.uva.nl> writes:
...
> I just noticed that in GHC.PArr, productP is defined wrongly
> 
> productP :: (Num a) => [:a:] -> a
> productP  = foldP (*) 0
> 
> in (the likely) case that PArr is deprecated, you may want to add
> a DEPRECATED-pragma.

I have just discovered that module recently through the paper
"An Approach to Fast Arrays in Haskell" at 
http://www.cse.unsw.edu.au/~chak/papers/CK03.html

I have found a bug in enumFromToP from 
http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libraries/
base/GHC/PArr.hs?rev=1.7

enumFromThenToP 6 5 1 ==> [:6,5,4:]
enumFromThenToP 10 8 1 ==> [:10,8,6:]

Mentioning this on the friendly #haskell channel got me this suggestion:

"TheHunter: hmm, i think enumFromThenToP = ... replicateP (((z - x) `div` delta)
+ 1) delta does the trick."

Regards,

Peter Eriksen



More information about the Glasgow-haskell-users mailing list