
Some time ago I noticed that a function I was writing had the exact type as liftM2, and I so I ended up generalizing a monad. I thought I should document it really well, and the result is this: http://www.downstairspeople.org/darcs/partial/Partial.pdf $ darcs get http://www.downstairspeople.org/darcs/partial I would appreciate any feedback. Is this even original? --Lane

Can you post any code using the monad? The article was interesting but I think it would make more sense if I saw some working code ... Justin

Can you post any code using the monad? The article was interesting but I think it would make more sense if I saw some working code ...
Justin
Ok. I wrote a simple implementation of the procedural texture example. This just runs on the CLI, printing the color that would be drawn. (I don't have the patience right now to implement a graphical version, nifty though that would be, because I wrote Partial originally to do the same thing with models in OpenGL. But that example is too complicated to be pedagogical, and will probably take days or weeks to write and test, modulo free time.) The example is here, and recall that ".../partial/" is darcs gettable: http://www.downstairspeople.org/darcs/partial/ProceduralTextureExample.hs When run, it looks something like this:
testTexture blue Color {color_red = 0.0, color_green = 0.0, color_blue = 1.0}
testTexture $ lighten red Color {color_red = 1.0, color_green = 0.5, color_blue = 0.5}
testTexture $ checkerboard yellow blue Hmmm. It looks like this texture varies by coordinate. Enter an x coordinate: 0 Enter a y coordinate: 0 Color {color_red = 1.0, color_green = 1.0, color_blue = 0.0}
testTexture $ checkerboard yellow blue Hmmm. It looks like this texture varies by coordinate. Enter an x coordinate: 4 Enter a y coordinate: 3 Color {color_red = 0.0, color_green = 0.0, color_blue = 1.0}
participants (2)
-
Christopher Lane Hinson
-
Justin Bailey