tag:blogger.com,1999:blog-7094652.post7164650686396987766..comments2018-09-07T14:50:00.516+01:00Comments on Neil Mitchell's Haskell Blog: Inside the paper: Build Systems a la CarteNeil Mitchellhttp://www.blogger.com/profile/13084722756124486154noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-7094652.post-49923346902963782722018-07-14T12:22:24.505+01:002018-07-14T12:22:24.505+01:00> The ones that come to mind are set(.~) and ov...> The ones that come to mind are set(.~) and over(%~).<br /><br />Ah, you are right! While `set` doesn't look particularly useful, `over` actually has an equivalent in out paper -- we call it `compute`. It allows one to compute the value of a task given a pure 'fetch :: k -> v' function. So, we can write:<br /><br />compute :: Task Monad k v -> (k -> v) -> k -> v<br />compute = over<br /><br />Pretty cool!Andrey Mokhovhttps://www.blogger.com/profile/18314567019729554255noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-36130393858716599622018-07-13T12:42:21.296+01:002018-07-13T12:42:21.296+01:00I think it's mainly setters and traversals. Th...I think it's mainly setters and traversals. The ones that come to mind are set(.~) and over(%~). I think you could also (.) those Task functions with existing stab lenses. <br /><br />Unless k can = v then most stuff (Getters, Folds, MonadState set/over) won't apply. You can use a lot of stab lenses with those things because they can often be specialised to be ssaa lenses.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7094652.post-80425423051651721612018-07-13T00:01:19.237+01:002018-07-13T00:01:19.237+01:00> Possible typo: in the definition of topologic...> Possible typo: in the definition of topological [...]<br /><br />Well spotted, many thanks! Just fixed it: https://github.com/snowleopard/build/commit/dbbe1322962cab3f523f61b7a6b3be57533cec44 :) This should make it into the published version.<br /><br />> This might just be a typo in the blog post. The library and paper appears to use [...]<br /><br />The blog post actually says: "We made a number of iterations on this Tasks type...". The type signature in the blog post is one of the earliest we used, e.g. see: https://github.com/snowleopard/build/blob/2e9c280b4221b823a269b97933a2de8c838f3ae8/src/Development/Build/Compute/Applicative.hs#L9<br /><br />> but I bet a lot of lens library functions would work on (non-wrapped) Tasks<br /><br />Could you show at least one? I haven't found a single lens library function that actually works on exactly this shape, where <b>stab = kvkv</b>. <br />Andrey Mokhovhttps://www.blogger.com/profile/18314567019729554255noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-87912359282660822262018-07-11T11:36:41.682+01:002018-07-11T11:36:41.682+01:00Possible typo: in the definition of topological, I...Possible typo: in the definition of topological, I think that "order = topSort (graph dep target)" should be "order = topSort (reachable dep target)"Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7094652.post-47219729371842421212018-07-09T15:11:40.740+01:002018-07-09T15:11:40.740+01:00This might just be a typo in the blog post. The li...This might just be a typo in the blog post. The library and paper appears to use <b>(k -> f v) -> f v</b> rather than <b>(k -> f v) -> (k -> f v)</b>. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7094652.post-25440996246770828662018-07-09T14:57:38.624+01:002018-07-09T14:57:38.624+01:00type Tasks c k v = forall f . c f => (k -> f...<b>type Tasks c k v = forall f . c f => (k -> f v) -> (k -> f v)</b><br />This is very similar to the types used in the lens library.<br /><b>type Lens x y a b = forall f. Functor f => (a -> f b) -> (x -> f y)</b><br />In particular (I think):<br /><b>Tasks Functor k v = Lens k v k v</b><br /><b>Tasks Settable k v = Setter k v k v</b><br /><b>Tasks Applicative k v = Traversal k v k v</b><br />The laws probably don't apply, but I bet a lot of lens library functions would work on (non-wrapped) Tasks, as well as id and (.). Anonymousnoreply@blogger.com