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}

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to