{"id":6,"date":"2007-07-24T22:22:52","date_gmt":"2007-07-25T05:22:52","guid":{"rendered":"http:\/\/www.elbeno.com\/haskell_soe_blog\/?p=6"},"modified":"2008-01-07T21:37:39","modified_gmt":"2008-01-08T05:37:39","slug":"exercise-21","status":"publish","type":"post","link":"https:\/\/www.elbeno.com\/haskell_soe_blog\/?p=6","title":{"rendered":"Exercise 2.1"},"content":{"rendered":"<pre lang=\"haskell\">data Shape = ...\r\n           | Polygon [Vertex]\r\n           ...\r\ntype Vertex = (Float, Float)\r\n\r\nrectangle :: Float -> Float -> Shape\r\nrectangle s1 s2 = Polygon [(x, y),  (-x, y), (-x, -y), (x, -y)]\r\n                  where x = s1 \/ 2\r\n                        y = s2 \/ 2\r\nrtTriangle :: Float -> Float -> Shape\r\nrtTriangle s1 s2 = Polygon [(0, 0),  (s1, 0), (0, s2)]<\/pre>\n<p>My rectangle is centred on the origin, with vertices in anticlockwise order, to match up with what&#8217;s coming in future chapters and exercises.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>data Shape = &#8230; | Polygon [Vertex] &#8230; type Vertex = (Float, Float) rectangle :: Float -> Float -> Shape rectangle s1 s2 = Polygon [(x, y), (-x, y), (-x, -y), (x, -y)] where x = s1 \/ 2 y = s2 \/ 2 rtTriangle :: Float -> Float -> Shape rtTriangle s1 s2 = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=\/wp\/v2\/posts\/6"}],"collection":[{"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6"}],"version-history":[{"count":0,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=\/wp\/v2\/posts\/6\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}