thank you very much Job.
Regards,
Kashyap
On Thu Aug 20th, 2009 1:13 PM EDT Job Vranish wrote:
Opps:
setPixel = State setPixel'
should be:
setPixel x y rgb = State $ setPixel' x y rgb
- Job
On Thu, Aug 20, 2009 at 1:05 PM, Job Vranish jvran...@gmail.com wrote:
Your setPixel function is
Hi,
I had posted a note on line drawing algo with Haskell some time back. Now, I am
trying to write a PNM image.
import qualified Data.ByteString as B
width = 256
height = 256
bytesInImage = width * height * 3
blankImage = B.pack $ take bytesInImage (repeat 0)
type Color = (Int,Int,Int)
Your setPixel function is almost ready to work in a State monad
If you modify your setPixel function slightly like so:
setPixel' :: Int - Int - Color - B.ByteString - ((), B.ByteString)
setPixel' x y (r,g,b) image = ((), B.concat [beforePixel, pixel,
afterPixel])
and then wrap it in the State
Opps:
setPixel = State setPixel'
should be:
setPixel x y rgb = State $ setPixel' x y rgb
- Job
On Thu, Aug 20, 2009 at 1:05 PM, Job Vranish jvran...@gmail.com wrote:
Your setPixel function is almost ready to work in a State monad
If you modify your setPixel function slightly like so: