
29 May
2013
29 May
'13
2:28 a.m.
On 5/26/13 12:38 AM, Mario Blaević wrote: > On 22/05/13 08:12 AM, Ian Lynagh wrote: >> On Wed, May 22, 2013 at 11:49:29AM +0800, John Lato wrote: >>> I suggest that we start a poll for a single, concrete proposal. If the >>> poll forum is by email or similar, I further suggest that replies be >>> limited strictly to +1/-1. >> I think there are 4 things it has been suiggested that we might do: >> * Generalise Prelude.mapM etc > > I've already given my +1 to this proposal, and I'm not likely to > change my opinion. I have to say, though, that the "etc" above is a > little sneaky. Now that the proposal has been overwhelmingly accepted, > can we narrow it down? I can see four different interpretations of the > "etc": > > 0. empty string; > 1. "mapM_, sequence, and sequence_"; > 2. intersection of exports of Prelude, Foldable, and Traversable, which > would include the above and also foldl, foldr, any, all, and, or, sum, > product, maximum(By), minimum(By), concat(Map), elem, and notElem; and > 3. every existing export of Prelude that can be generalized to Foldable > or Traversable, which would be all of the above and then some others > like map, filter, length, null, takeWhile, dropWhile, span, break, take, > drop, splitAt, and probably some more. I agree with Edward Kmett's analysis; i.e., option #2 or thereabouts. Much as I'd like to see some of the others generalized (i.e., map, filter, length, null) I think that goes beyond the wording of the original proposal. Also they're not strictly Foldable/Traversable ideas, but rather belong to other classes. As per Ian Lynagh's comments, I think all the bits of Control.Monad that are restrictions of Foldable/Traversable should also be removed (or generalized as re-exports). That is, we're looking at something like: (Prelude \cup Control.Monad) \cap (Data.Foldable \cup Data.Traversable) As far as the menagerie of fold variants, I'd like to see foldl' and foldr' go along with foldl and foldr; but I don't have any particular opinion on the others. The biggest outstanding issue, I think, is how to deal with build/foldr fusion. That is, we must be sure that with all these changes we do not break fusion. That should be doable with the right incantation of inlining, but it's something we need to be sure still works. -- Live well, ~wren