Twinside/Juicy.Pixels — pull request #24 by dagit (2013-05-11 01:54:31+00:00)
Title: Use PrimMonad in Pixel typeclass api

Hello,

I see that you implemented `withImage` and so I went through and made the `Pixel` typeclass use `PrimMonad` instead of `ST`. I've also refactored my ray-tracer to match, this allowed me to simplify a few things :) Do you know when you will make the next release?

I'm also wondering if you want to include this function:

```
mkMutableImage :: forall p m. (Pixel p, PrimMonad m) => Int -> Int -> m (MutableImage (PrimState m) p)
mkMutableImage width height = do
let compCount = componentCount (undefined :: p)
v <- M.replicate (width * height * compCount) 0
return $! MutableImage { mutableImageWidth = width
, mutableImageHeight = height
, mutableImageData = v }
```

It's useful for me because sometimes I want to create a mutable and update it later. I would imagine that others will end up writing that function too, but it's really hard to say my use case is really pretty specific. I could use your new `withImage` function, but in the place where I use `mkMutableImage` I was simply too lazy to refactor it.

I believe this pull request finishes up all the desired functionality from #23.

Thanks again!