{"id":16,"date":"2007-07-26T22:12:42","date_gmt":"2007-07-27T05:12:42","guid":{"rendered":"http:\/\/www.elbeno.com\/haskell_soe_blog\/?p=16"},"modified":"2009-03-29T22:46:50","modified_gmt":"2009-03-30T06:46:50","slug":"exercise-52","status":"publish","type":"post","link":"https:\/\/www.elbeno.com\/haskell_soe_blog\/?p=16","title":{"rendered":"Exercise 5.2"},"content":{"rendered":"<pre lang=\"haskell\">map map [x] = [map x]<\/pre>\n<p>Therefore:<\/p>\n<pre lang=\"haskell\">x :: a -> b<\/pre>\n<p>because <tt>x<\/tt> is the first argument to <tt>map<\/tt>. Consider the type of map:<\/p>\n<pre lang=\"haskell\">map :: (a -> b) -> [a] -> [b]<\/pre>\n<p>This implies:<\/p>\n<pre lang=\"haskell\">map x :: [a] -> [b]\r\n[map x] :: [[a] -> [b]]<\/pre>\n<p>And hence:<\/p>\n<pre lang=\"haskell\">map map :: [a -> b] -> [[a] -> [b]]<\/pre>\n<p>\u00e2\u20ac\u201c<\/p>\n<pre lang=\"haskell\">foldl foldl x [y] = ?<\/pre>\n<p>This is a type error. See <a href=\"http:\/\/haskell.org\/soe\/Bug\/erata.htm\">technical error 10<\/a>.<\/p>\n<p>\u00e2\u20ac\u201c<\/p>\n<pre lang=\"haskell\">map foldl [x] = [foldl x]<\/pre>\n<p>And as before:<\/p>\n<pre lang=\"haskell\">foldl :: (a -> b -> a) -> a -> [b] -> a\r\nx :: a -> b -> a\r\nfoldl x :: a -> [b] -> a\r\n[foldl x] :: [a -> [b] -> a]\r\nmap foldl :: [a -> b -> a] -> [a -> [b] -> a]<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>map map [x] = [map x] Therefore: x :: a -> b because x is the first argument to map. Consider the type of map: map :: (a -> b) -> [a] -> [b] This implies: map x :: [a] -> [b] [map x] :: [[a] -> [b]] And hence: map map :: [a -> [&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\/16"}],"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=16"}],"version-history":[{"count":2,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=\/wp\/v2\/posts\/16\/revisions"}],"predecessor-version":[{"id":64,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=\/wp\/v2\/posts\/16\/revisions\/64"}],"wp:attachment":[{"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}