3 ms·
To some degree it reminds me of a change in Haskell that came about a few years back. It used to be the case that many of the basic functions operated on things
by 6gvONxR4sf7o 7y ago
To some degree it reminds me of a change in Haskell that came about a few years back. It used to be the case that many of the basic functions operated on things like lists and functions. Tricky to learn but not too bad. It got annoying when you wanted to use those tools on generalizations of lists, so the language changed. Now those standard library functions operate on things like the Foldable type class which is must follow some laws defined in terms of endomorphisms. So simple functions like “any” or “concat” which used to operate on lists and be super newbie friendly still can operate on lists in the same way, but now do lots more, at the expense of the newbies (and complexity).
I think the change was jokingly called “pulling up the ladder behind us.”
Learning some command line commands feels like learning a whole new framework. A man page should rarely need to be a whole damned manual.
- geofft 7y agoThey still work on plain lists with the same syntax you could always use (that is, lists are a member of the Foldable type class), right? If so, then this primarily seems like an issue of how to present the documentation and not the mechanics of the change itself. Instead of autogenerating docs that say concat :: Foldable t => t (t a) -> t a (or whatever) and making people think about Foldable, write docs that say that concat is still [[a]] -> [a], with a note at the bottom saying, by the way, this generalization exists, click here to see the more complicated version if you've decided you care about Foldable. Probably the text of the docs remains the same, in fact ("concatenate a list of lists together into a single list"), you just display the real prototype and explain that "list" could also mean something else. (There's a number of ways to implement this, from writing docs by hand, to extending the doc protocol to support this specific case of lists and Foldable, to extending the doc protocol to support documenting a fake function prototype and then have a link to the real function at the bottom, and using the type system to ensure that the fake prototype is just a special case of the real function.) A corollary is that documentation presentation is an inseparable part of library / tool design.
- kqr 7y agoThe other problem are type errors, which would then require knowing about Foldable to operate on lists. The same type of solution that you propose for docs can work here too, though. The compiler can trivially substitute the typeclass for any known instance.