4 ms·
To illustrate this point, a choice snippet from that Reddit thread, explaining part of what seems to be considered 'the proper solution'. Please note that my in
by Confusion 16y ago
To illustrate this point, a choice snippet from that Reddit thread, explaining part of what seems to be considered 'the proper solution'. Please note that my intention is not to make fun of this, but to illustrate that the terminology in which people in the Haskell community communicate makes it impenetrable for someone just trying to pick up the language and do stuff with it.
it's a straightforward lifting of the non-monadic version. You can almost get
it from g_hylo by using the identity comonad, it's distributivity law, the
identity natural transformation, and using T.sequence as the monad's
distributivity law[1]. But this doesn't quite get us there because it requires
that we can refactor the monadic parts of the coalgebra into the algebra.
http://www.reddit.com/r/haskell/comments/cs54i/how_would_you_write_du_in_haskell/c0uxleq http://www.reddit.com/r/haskell/comments/cs54i/how_would_you...
- silentbicycle 16y agoWell, sure. Haskell uses mathematical terminology sometimes. Other languages use weird terminology, too: "public static void main"? How about "pure virtual destructor"? "Visitor"?
- jberryman 16y agoThere isn't really a reason why someone picking up haskell should have to understand language like this when they encounter it.
- applicative 16y agoI think you are being misled by the seemingly simple headline "how would you write du...". The question was not straightforwardly practical but deep in the territory of so-called 'recursion schemes: The natural way to do this is to use an unfold to generate a list or tree of all the files in the directory tree, map over them to get the sizes, and do a fold to get the total. -- And similarly elsewhere, more explicitly, as he makes clear why he isn't interested in the 'obvious' solutions, e.g.: Yep, this is a good practical approach if I just want to "du". I'm looking specifically for the fold . map . unfold approach ... The interventions of doliorules and then winterkoninkje (whom you quote) were in fact the ones that spoke to his condition.