[Haskell-cafe] Image processing using Repa

Janek S. fremenzone at poczta.onet.pl
Wed Oct 10 15:23:18 CEST 2012

> You do not have to use computeIntoP. You can just use computeP followed by
> toForeignPtr (i don't remember the exact name for that and am on my phone
> so it would be awkward to look up). So Repa can create the buffer for you.
> Coincidentally, I didn't realize computeIntoP even existed, and I want it
> for what I'm doing!
I managed to fix my code - thanks! The main function now reads:

main = do
    [f] <- getArgs
    (RGB v) <- runIL $ readImage f
    rotated <- (computeP $ rot180 v) :: IO (Array RFP.F DIM3 Word8)
    runIL $ writeImage ("flip-"++f) (RGB rotated)


More information about the Haskell-Cafe mailing list