Sunday, October 25, 2015

Stick man in haskell

Today some feel good code in Haskell:
man :: Diagram B
man =
        circle 1.2 # center
    ===
        ((rotateBy (-0.1) (vrule 3)) ||| (vrule 3) ||| (rotateBy 0.1 (vrule 3))) # center
    ===
        ((rotateBy (-0.1) (vrule 3)) ||| (rotateBy 0.1 (vrule 3))) # center
  which produces the following svg stick man:

You need to call it like this:
main = mainWith $ man