Skip to Content
0
Former Member
Oct 22, 2006 at 03:20 PM

Sequencing impure functions

28 Views

I&#39;m writing the Graphics (or SOEGraphics) module as used in Haskell SOE, based on your Plot example. <br /> I&#39;m not sure what the best way to sequence drawing function is, in the absence of &#39;do&#39; and the IO Monad. <br /> For example, where SOE has sierpinskiTri w x y size = if size <= minSize then fillTri w x y size else let size2 = size `div` 2 in do sierpinskiTri w x y size2 sierpinskiTri w x (y - size2) size2 sierpinskiTri w (x + size2) y size2 I have: sierpinskiTri w x y size = if size <= minSize then fillTri w x y size else let size2 = size / 2; in seq (sierpinskiTri w x y size2) (seq (sierpinskiTri w x (y - size2) size2) (sierpinskiTri w (x + size2) y size2) ); My solution works, but I don&#39;t think I understand Haskell or CAL deeply enough to be sure if it is a good solution. <br /> Tom