[Haskell] Image manipulation

Ketil Malde ketil+haskell at ii.uib.no
Thu Nov 1 05:03:32 EDT 2007


Simon Peyton-Jones <simonpj at microsoft.com> writes:

> | GHC nominally does do it (look for 'selector thunks' in the RTS and
> | commentary), but it doesn't work and we don't know why.
> |
> | http://hackage.haskell.org/trac/ghc/ticket/1038

> That bug is alleged to be fixed.  Do you think it isn't?

I'm not sure to what extent the fix should cover my case, but if I may
restate it, what I certainly found was that by replacing my
partitioning function

  breaks p = groupBy (const (not.p))

by

  breaks :: (a -> Bool) -> [a] -> [[a]]
  breaks p (x:xs) = let first = x : takeWhile (not.p) xs
                        rest  = dropWhile (not.p) xs
                    in  rest `par` first : if null rest then [] else breaks p rest
  breaks _ []     = []

space consumption was drastically reduced -- as long as I compile with
-smp.  Previous space consumption appeared to be linear in the largest
partition (although I made no accurate measurements).

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Glasgow-haskell-bugs mailing list