News for hackers. Stuff that matters.
Re:Go proposal: new package to provide generic slice functions by sabellito on Wednesday May 05, 2021 @09:44AM (#27049692)
I think it's to do with the community and what people who are really into Go are interested in.

The first reply to the thread deems "map" and "filter" borderline-useful, but "reduce" not worth it - that type of misunderstading just shows that the author (and the 60+ people who +1'd it) didn't spend enough time understading functional constructs yet.

Re:Go proposal: new package to provide generic slice functions by majewsky on Wednesday May 05, 2021 @09:53AM (#27049805)
This is not about misunderstanding. The author argues that heavy map/filter/reduce does not fit with the general style of Go programs. As a heavy Go user, I absolutely agree.

There is nothing preventing people from writing their own reduce() in their own utilities package, and I expect a thriving ecosystem of "even-more-functional-constructs" packages to spring up as soon as generics hit stable.

The discussion in this proposal is not about this. It's only and entirely about what the stdlib should provide, and that is much more a question of practical and idiomatic usage than it is about one's understanding of a theoretical CS syllabus.

Re:Go proposal: new package to provide generic slice functions by jerf on Wednesday May 05, 2021 @10:01AM (#27049902)
I need to update this for the latest generics syntax, but I wrote this a while back: http://www.jerf.org/iri/post/2955 "Why Go Getting Generics Will Not Change Idiomatic Go"

I do not understand the people who think that functional-esque programming is the only and best way to do things who are apparently just sitting and waiting for Go to be able to do it. Are you forced to use Go or something? This is an honest question, btw, and I am legitimately interested in answers. If the only reason or the biggest reason you're not using Go is that you can't import map-centric programming into it, why not use any of the many languages that support that rather than griping about a language where it's still ultimately going to be bodged on? Again, honest question, because there's no shortage of such languages.

My perception is that Go isn't that popular that there's a lot of people forced to use it against their will because it's just The Language.

Anyhow, even after generics drop, it still isn't going to be any fun. I expect to use a map here or there often enough that it'll be nice to have it in the standard library but there's no realistic way that it's going to become "the best way to program in Go". If you're waiting to try it out after the generics drop, I would suggest trying something else instead; Elixir, Nim, Crystal, Pony.

Re:Go proposal: new package to provide generic slice functions by morelisp on Wednesday May 05, 2021 @01:14PM (#27052703)
> Are you forced to use Go or something?

I mean, yes, most companies have a relatively small list of supported languages, whether explicitly or practically. If someone at our company wants to write a program that does some binary data munging that's even more frustrating in Java, and needs to do it faster than Python allows, they have to use Go. We will not let them use C or C++, because most of the team will not understand it and it won't be able to integrate with any of our standardized libraries or CI infrastructure.

Re:Go proposal: new package to provide generic slice functions by 1_person on Wednesday May 05, 2021 @04:37PM (#27055424)
Your statements in the blog about performance of that pattern are not accurate to the best of my knowledge.

A program structured as a sequence of short, tight loops over vectors/slices as described is more or less hitting the performance sweet spot of modern microarchitectures.

The general form of a short loop over a vector plays to the strengths of branch prediction and the instruction cache while the temporal and spatial locality of the memory accesses are conducive to caching and pipelining.

Moreover, there's usually no need to allocate or copy the array in that sort of data flow. I mean, unless you're chasing worst case performance to make a point or something. Slice the buffers out of a pool and allow ownership of the data to follow the execution context, then you're free to modify it in place.

The above points cover 3-4 orders of magnitude real world performance.

It is true that there are some issues with the optimizer working in this pattern but I have only seen performance severely degraded in this pattern by compile time type ambiguity -- some but not all interface{} parameters, anonymous functions / closures in scopes with dynamic type. Interface types with a pointer receiver do not typically encounter these specific issues, and I believe the empty interface type has much better performance since ~1.12 or so as well.

Re:Go proposal: new package to provide generic slice functions by jerf on Thursday May 06, 2021 @03:34PM (#27068094)
"A program structured as a sequence of short, tight loops over vectors/slices as described is more or less hitting the performance sweet spot of modern microarchitectures."

Sure, but even faster is not to loop over intermediate arrays at all, by virtue of never constructing them in the first place when they aren't necessary.

"Moreover, there's usually no need to allocate or copy the array in that sort of data flow. I mean, unless you're chasing worst case performance to make a point or something. Slice the buffers out of a pool and allow ownership of the data to follow the execution context, then you're free to modify it in place."

That starts getting into "I'm sure someone can come up with some solution that meets some of these goals". Whatever map you're talking about here isn't one that is defined as creating a new slice based on mapping a function over the old slice. I mean, it kinda sounds like you're saying "well, if you just write a conventional for loop you can do all this in one pass" to me? Which is my point? I'm not the one pitching for lots of array creation, it's people who insist on using maps and filters in a language that, of all the major languages, just isn't going to put in the optimization time to convert them back into loops under the hood.

Re:Go proposal: new package to provide generic slice functions by 1_person on Wednesday May 12, 2021 @09:07PM (#27137277)
I think the pragmatic current realization of a functional data flow pipeline as described in my earlier reply incidentally achieves exactly what you mention here:

> Sure, but even faster is not to loop over intermediate arrays at all, by virtue of never constructing them in the first place when they aren't necessary.

In those examples of this type of pipeline, the vectors you start with are slices of hardware device descriptor queues which reference a DMA region, and by progressive transformation of the receive buffers and composition with additional buffer regions through intermediate decoded states you produce reply buffers.

The hardware is programmed to sample only the packets of interest to this descriptor queue, and copies the packets matching this filter directly to the DMA region referenced in the descriptor it places in the queue.

With sufficiently sophisticated hardware it is possible to offload decode of increasingly large fragments of protocol logic or even entire applications.

Description of the operations in a language of common composable operations over the type of vectors of buffers allows the amount of any given application which is mapped to e.g. general purpose CPU, GPU or other FPGA/ASIC offload feature instructions to vary continuously over time or API surface at runtime pretty neatly, it creates breakpoints in the logic flow that more or less always map exactly to functional hardware boundaries, because everything's pretty much just vectors of buffers all the way down really when you think about it. Your process's entire runtime is just another vector of buffers to the kernel.

Re:Go proposal: new package to provide generic slice functions by 1_person on Friday May 07, 2021 @12:54PM (#27078024)
> That starts getting into "I'm sure someone can come up with some solution that meets some of these goals".

The sooner we, as engineers, can collectively acknowledge that we're doing things so wrong it's costing us approaching 4 orders of magnitude performance, and agree to stop dismissing knowledge of the hardware as forbidden knowledge, and abusing acceptance of reality as pointless micro-optimization... then I'm sure we'll make progress towards accepting one of the many patterns people have been advocating for upwards of a decade which do solve these problems.

One of the patterns which happens to be able to reclaim most of those missing 4 orders of magnitude performance is functional data flow, which is by unfortunate coincidence essentially the pattern you're denouncing here for its performance. It actually maps almost directly to the ideal implementation because it's ... literally expressing problems in terms of vector operations with no data dependence, which maps perfectly to a parallelized pipeline of the instruction types that achieve near optimal throughput and realized IPC.

I am not trying to be a dick but I am very passionate about this topic and I disagree very strongly with your assessments of the performance here.

Re:Go proposal: new package to provide generic slice functions by hughrr on Wednesday May 05, 2021 @11:24AM (#27051088)
Your blog post was a great read. Completely agree. I’ve seen so much stuff turn to excrement the moment FP is applied.

I’m writing a complex aggregator in go and the abstraction is buffered channels. There is no map or filter in sight. It is not needed.

Re:Go proposal: new package to provide generic slice functions by mohanmcgeek on Wednesday May 05, 2021 @10:21AM (#27050197)
Many problems for which you might end up using something like Kafka streams just lend themselves nicely into the streams/collections -like style

I am happy using Go right now when they don't have map.. but including map and not including reduce/flatten is just odd

Re:Go proposal: new package to provide generic slice functions by jerf on Wednesday May 05, 2021 @11:10AM (#27050877)
"Many problems for which you might end up using something like Kafka streams just lend themselves nicely into the streams/collections -like style"

Have you actually taken the time to write out what it looks like, as I have in that blog post above, though? It's not pretty. Any sane Go programmer is not going to want to use this for very much. (I write that carefully. I anticipate using it a non-zero amount myself. But it's not going to be a lot.)

I understand liking map/filter/reduce, even if it is the beginning of functional programming rather than the end. I don't understand absolutely demanding it in languages where it doesn't fit well and insisting on using it no matter the cost.

Re:Go proposal: new package to provide generic slice functions by MAGZine on Wednesday May 05, 2021 @01:47PM (#27053148)
it's pretty clear to me. people coming from other languages are used to typing less characters and expressing their ideas like that, and they want to type less characters in go.

for go, a language that idiomizes variable names like `f`, you think that people would be more on board with fewer characters. There are many other areas where go has chosen to avoid tidying up the syntax/making lives easier in the name of simplicity, though I digress.

As for your earlier question of "why don't you pick another language," I think this is a silly question to ask. The vast majority of people working for hire are not picking their language. If you have a few hundred kloc written in go, I doubt very much people are in a position to casually introduce new languages, especially if they're trying to improve the current system.

Re:Go proposal: new package to provide generic slice functions by jerf on Wednesday May 05, 2021 @02:24PM (#27053716)
"it's pretty clear to me. people coming from other languages are used to typing less characters and expressing their ideas like that, and they want to type less characters in go."

It's not. It's more. A lot more sometimes, plus the indentation for trying to chain maps together is ugly.

I think more people who think this is going to be great need to clock some time on the Go Generics playground [1], implement some Map and Filter and MapError functions, and convert some real code to this style in real Go. It's awful. I'm probably spoiled by Haskell and how nice it makes all this, but it's awful even against normal Go code. Try it.

The problem is, the thing that makes "functional-style" programming in Go difficult wasn't "missing generics". It was, missing generics, somewhat heavy-weight anonymous function syntax, indentation rules not optimized for deeply-nested functions, a compiler that almost certainly won't optimize through very many layers of these constructs, the inability to put methods on core types and the fact the core types are missing the useful methods/interfaces like "Traversable", no higher kinded types so no monads or anything else like that, a variety of little syntax issues that make this all slick, and probably some things I'm missing. Just getting some generics (and not having generic methods that can add new generic types hurts this style too) just isn't enough to make it slick. Go would need a suite of changes to make this slick and efficient, not just these generics.

[1]: https://go2goplay.golang.org/

Re:Go proposal: new package to provide generic slice functions by Serow225 on Wednesday May 05, 2021 @12:50PM (#27052356)
I dunno, for some domains it feels like 80% of the job openings are using Go.
Re:Go proposal: new package to provide generic slice functions by marcus_holmes on Wednesday May 05, 2021 @10:08AM (#27050001)
This is, in part, why I'm generally not in favour of generics in Go.

Go has a common style across most code bases I've seen. Partly that's because Go is opinionated about style, and doesn't really support doing things any other way. I don't see this as a bad thing, though that may well be because Go's style happens to be similar to my own. I have friends who learned to code on Ruby and JS and who don't like Go at all, because it doesn't really support the way they like to write code.

Adding the ability to write functional-ish code to Go is going to fragment the style. There will be code bases written in functional-ish Go that are difficult to understand for people used to a more imperative style. And vice versa (though I suspect imperative is easier to understand). I don't see this as a good thing. It's kinda "if you want to write functional-ish code, why not pick a language that you can do that in, instead of demanding that Go supports it?". But I realise this is probably a lost cause, and we're going to see that wave of "even-more-functional-constructs" become so common that we end up with JS-like library churn.

Re:Go proposal: new package to provide generic slice functions by qsort on Wednesday May 05, 2021 @10:46AM (#27050513)
I'm not really a Go expert, but I've dabbled a little bit in it and I like it a lot. Why do you believe generics specifically would cause fragmentation? Isn't it more of a standard library issue?

Probably I'm looking at it the wrong way, but it looks to me like it's a relatively harmless language extension with the added bonus of correctly typing stuff normally cast as interface{}.

Re:Go proposal: new package to provide generic slice functions by marcus_holmes on Wednesday May 05, 2021 @11:24AM (#27051090)
I've been writing Go for 8+ years now, I guess. In all that time I've maybe hit 3 or 4 problems that generics would have helped with. And there were always workarounds (tending to be heavy on the boilerplate). This is fairly common, from the other Gophers I've talked to.

The problem with generics is they're a hammer, and everything is going to look like a nail. Instead of being a rarity, and everyone basically writing idiomatic Go as normal and only pulling out the generics when really needed, this functional-ish style that relies on generics (as in TFA) will become common.

Devs who are used to writing array.map code in JS will start on Go and immediately find the slices package in the standard lib, and create a generic for every single slice they use, because that's what they're used to and how they think it's meant to be used. For...range loops will look as old-skool and primitive as for loops look in modern JS (despite all their advantages).

We already have the "learning path" of newbie Gophers, whose first question is always "which framework should I use?", and it's an uphill battle getting them to accept that they should just use the standard lib. Trying to get them to accept that they basically never need generics is going to be harder.

Old crusty Gophers like me, who are used to and like the simplicity of idiomatic Go, will be left shouting into the void. Again.

edit: typing stuff as interface{} is also one of those things that you learn to get past. I'm working on a ~80Kloc Go code base at the moment, and have not had to resort to interface{} once yet. Interfaces are way more powerful than they appear at first. I'm not saying interface{} doesn't have its place, and it's used heavily in the standard library, but it's not as common as you'd think at first glance.

Re:Go proposal: new package to provide generic slice functions by jasonwatkinspdx on Wednesday May 05, 2021 @01:13PM (#27052692)
The biggest problem is the opportunity cost, and you may not be aware of just what you're giving up if you've not done substantial work in other ecosystems over the years.

The two big places this shows up in golang, imo, is the lack of high quality data structure libraries, and the lack of widely used standard library for routine channel management tasks.

The former is a huge opportunity cost. If I'm coding on .net, jvm, c, or c++ I have a variety of state of the art data structures available. Some of these structures are extremely difficult to develop, so the "just write your own boilerplate" approach is completely insufficient. Point to code generation templates all you want, the reality is that this problem is preventing golang from improving much past using mutex protected hash maps and google's interface{} typed btree. Meanwhile, if we look at say .net, you have a very high quality lock free concurrent hash table available that scales to massive heap sizes. This is no niche thing: the bw-tree / cosmosdb storage engine is entirely designed around the capabilities of this lock free map. It's easily responsible for 100's of millions of dollars of value to software in that ecosystem now.

The lack of simple, clear, and useful channel lifetime management functions is another rough edge that bites many go programmers daily. The many abuses of Context make this problem quite clear.

I understand the sentiment of not wanting golang to turn into the Stephanov style C++ generics. But I think that's an imaginary fear. The golang generics design is quite different and far more "gopher" for lack of a better term. The problems golang is facing due to poor type flexibility in this area are not imaginary: they are endemic.

Re:Go proposal: new package to provide generic slice functions by marcus_holmes on Wednesday May 05, 2021 @02:13PM (#27053561)
I used to code in C# before Go. This isn't my first rodeo. Or even my second.

And I get that Go lacks in some areas. That's fine. All languages lack in some areas. Go wasn't designed to be all things to all people. It's very good at writing servers in. And there's a few projects written in Go that have proven to be pretty popular and scaled well ;)

It's not really YAGNI, which Go has been accused of (a lot), with some justification. It's more that simplicity is valuable, but it has a cost. Keeping Go simple is good, but the price of that simplicity is sometimes high. As you say, there is an opportunity cost.

I still think that cost is worth paying, and I'm not convinced (yet - I may be in time) that the reduction in simplicity that comes with generics is a price worth paying for the flexibility it brings.

Re:Go proposal: new package to provide generic slice functions by throwaway894345 on Wednesday May 05, 2021 @11:24AM (#27051084)
Probably because generics allow for many different programming paradigms, and different packages will use different paradigms, requiring developers to understand all of them and integrate them. In addition to varying paradigms, packages will also vary in their degrees of abstraction—generics permit very abstract code while idiomatic Go code is not particularly abstract. Note that I’m not arguing that these tradeoffs aren’t worth the while, just that they do in fact exist.
Re:Go proposal: new package to provide generic slice functions by solosoyokaze on Wednesday May 05, 2021 @10:57AM (#27050685)
> There is nothing preventing people from writing their own reduce() in their own utilities package, and I expect a thriving ecosystem of "even-more-functional-constructs" packages to spring up as soon as generics hit stable.

I really hope this doesn't happen because then you have random utility libraries that "infect" projects for what is essentially basic flow control. I would say stuff like this is best supported in the standard lib and not home rolled.

Re:Go proposal: new package to provide generic slice functions by sabellito on Wednesday May 05, 2021 @10:00AM (#27049891)
If you re-read the comment I was replying to I don't think your comment as a reply to mine makes a lot of sense.

I'm not arguing what's good and bad, nor what should or should not be in the Go language.

Re:Go proposal: new package to provide generic slice functions by throwaway894345 on Wednesday May 05, 2021 @11:08AM (#27050834)
> The first reply to the thread deems "map" and "filter" borderline-useful, but "reduce" not worth it - that type of misunderstading just shows that the author (and the 60+ people who +1'd it) didn't spend enough time understading functional constructs yet.

It’s not very charitable to assume that people who disagree with you must not understand your position. In particular, one person could like reduce() because it’s very abstract and can be used for lots of problems, but critics could dislike it because very high levels of abstraction impede readability. Both parties may understand each other, but they are optimizing for different things (abstraction for its own sake and readability, respectively).

Re:Go proposal: new package to provide generic slice functions by sabellito on Wednesday May 05, 2021 @01:04PM (#27052557)
I definitely didn't mean it as an insult, as my comment is a reflex of my own journey understanding these concepts. I'm also absolutely not an FP expert. Different people have different levels of understanding about different things, this has nothing to do with intelligence or a general programming skill level.

I do think this is about understanding, as it's not about syntax, or what feels nicer. It's about building blocks and what comes before what. Given the nature of the proposed library, to give the users an arbitrarily less abstract construct is a design mistake as I mentioned in another comment in this thread.

For example, I remember when I needed to flatten a bidimensional array in JavaScript, perhaps back in 2005, and the internet told me that I needed to flatten the array. So I learned then that array.flatMap() served that purpose: to flatten a bidimensional array. This is of course incorrect, but it took me many years until I found the concept again and understood what were the building blocks around flatMap, and what kinds of other abstractions it allowed.

Re:Go proposal: new package to provide generic slice functions by throwaway894345 on Wednesday May 05, 2021 @01:47PM (#27053149)
> I do think this is about understanding, as it's not about syntax, or what feels nicer. It's about building blocks and what comes before what. Given the nature of the proposed library, to give the users an arbitrarily less abstract construct is a design mistake as I mentioned in another comment in this thread.

Per my earlier comment, it's only "a design mistake" if you assume that it's always better to trade readability for abstraction. This isn't always the case, and in professional software engineering it's often better to optimize for readability--rarely are high degrees of abstraction beneficial (of course, someone will respond to this with some anecdotes of the instances in which high degrees of abstraction are helpful, which is just an enumeration fallacy).

Re:Go proposal: new package to provide generic slice functions by foldr on Wednesday May 05, 2021 @09:51AM (#27049779)
Reduce is basically "loop over this list while maintaining state". If you have loops and state built in, it doesn't buy you a whole lot.

I don't think the aim of the package is to move Go towards a more functional style. Rather, it's to provide a set of utility functions that mesh with the style of existing Go code. For example, it would be useful to have a utility to 'pop' an element from a slice, even though that's not a particularly functional idiom.

Re:Go proposal: new package to provide generic slice functions by sabellito on Wednesday May 05, 2021 @10:06AM (#27049964)
I definitely wasn't arguing about what should or should not be in the package. I just replied to the parent comment with my idea as to why the discussion around this point is happening in the proposal.
Re:Go proposal: new package to provide generic slice functions by kubb on Wednesday May 05, 2021 @12:00PM (#27051629)
Bingo, Go is geared towards junior programmers. Somebody who exits the university has to be able to feel productive within two weeks of using it. That's literally the cornerstone of the entire design and all things follow from it (C-like syntax, attempt to minimize the number of language constructs, and the heavy focus on imperative programming which is what they teach in college).
Re:Go proposal: new package to provide generic slice functions by cy_hauser on Wednesday May 05, 2021 @03:25PM (#27054472)
Oh the unintended irony. Go's syntax may be simple enough to pick up in a few weeks but writing "good" Go code turns out to be much much harder. Idiomatic Go can take a year or two to internalize and introducing non idiomatic Go code into an established code base can really muck it up.

You can see this clearly in job listings looking for Go coders. Almost nobody is looking for junior level Go coders with less than a year of experience. Companies are looking for Go coders with at 2, 3, 5+ years of experience instead.

A simple syntax may provide benefits, but it doesn't seem to be the benefits most companies want in practice after all.

Re:Go proposal: new package to provide generic slice functions by brandonmenc on Wednesday May 05, 2021 @06:39PM (#27056732)
> Almost nobody is looking for junior level Go coders with less than a year of experience.

I have never seen a job posting asking for less than a year of experience with anything.

Re:Go proposal: new package to provide generic slice functions by cy_hauser on Wednesday May 05, 2021 @09:35PM (#27058161)
True, but what other languages or other anythings are doing is at best irrelevant and at worst the entire point.
Re:Go proposal: new package to provide generic slice functions by tsdlts on Wednesday May 05, 2021 @09:53AM (#27049795)
Or maybe they understand them perfectly and have come across enough obtuse code using reduce to not want it as part of the language.
Re:Go proposal: new package to provide generic slice functions by sabellito on Wednesday May 05, 2021 @10:05AM (#27049950)
Everyone draws the "code that I like looking at"-line at different places.

Despite our wishes around that, functional constructs do have a hierarchy of abstraction vs power, and skipping a layer is the type of design that backfires in the end, like with Java doubling down on the collection APIs without introducing monads explicitly for users.

Re:Go proposal: new package to provide generic slice functions by creata on Wednesday May 05, 2021 @10:41AM (#27050436)
> Java doubling down on the collection APIs without introducing monads explicitly for users.

I'm not necessarily disagreeing with you, but how has that backfired for Java? It seems as popular as ever, and I don't hear many people lamenting the lack of monads in Java.

Re:Go proposal: new package to provide generic slice functions by sabellito on Wednesday May 05, 2021 @12:28PM (#27052025)
Ah thanks for pointing that out as I didn't make myself clear. I definitely didn't mean Java as a whole, as it is indeed a tremedously successful platform and language.

I meant specifically the lack of flexibility in some regards because of the missing of monads and friends.

For example, we have a few newer languages, TypeScript and Kotlin come to mind, implementing the "null operator":

   thing?.fieldA?.fieldB
While this is quite handy, and people unfamiliar with the Option monad will think that this new syntax is really cool, it poses two limitations: 1. It doesn't compose with other abstractions 2. I can't use this for my own abstractions

If the language designers had chosen to take one step back and implemented it in a more generic way (in some sense, in the same as my other comment in this thread about implementing "map" without "reduce"), the feature could've still been implemented in the language, but without the limitations.

I'm not sure what you meant with this point:

> people lamenting the lack of monads in Java.

Do you mean that, because you don't see people lamenting, it's not a useful feature?

Re:Go proposal: new package to provide generic slice functions by creata on Wednesday May 05, 2021 @12:43PM (#27052259)
> It doesn't compose with other abstractions

But monads don't compose with each other, do they? I thought you needed something more (monad transformers, algebraic effects, etc.) to get things to compose. Or maybe you meant something else by composition.

> I can't use this for my own abstractions

Yep. But Java doesn't even let you overload addition afaik, so being able to overload ? is pretty much a pipe dream.

> Do you mean that, because you don't see people lamenting, it's not a useful feature?

No, it's just that if something "backfired" for Java, I'd expect to hear people complaining about it.

Re:Go proposal: new package to provide generic slice functions by a1369209993 on Wednesday May 05, 2021 @07:21PM (#27057171)
> But monads don't compose with each other, do they?

They do if they're[0] traversable (cf literally `Data.Traversable` in Haskell), which almost all specific monads are. You'd have something like:

  newtype Comp f1 f2 a = Comp { unComp :: (f1 (f2 a)) }
  instance (Monad f1,Monad f2,Traversable f2) => Monad (Comp f1 f2) where
    (Comp a) >>= k = Comp $ a >>= (map join . traverse (unComp . k))
Edit: 0: actually, only the inner monad needs to be traversable.
Re:Go proposal: new package to provide generic slice functions by creata on Thursday May 06, 2021 @01:23AM (#27059444)
Looks like that that's not a valid monad in general.[0] And also, I feel like it's a stretch to say that "almost all specific monads" are traversable.

[0]: https://stackoverflow.com/questions/42284879/is-the-composit...

Re:Go proposal: new package to provide generic slice functions by a1369209993 on Thursday May 06, 2021 @03:10AM (#27060034)
I'm not convinced (Bool->) is a legitimate Traversable[0], but that's at least highly concerning and makes me wish the typechecker could properly handle "Instances should satisfy the following laws" comments as actual code.

0: in vaguely the same way that Int isn't a legitimate Monoid because you get nonsense by switching back and forth between sum and product (and min, max, xor, and, or, etc)

Re:Go proposal: new package to provide generic slice functions by masklinn on Wednesday May 05, 2021 @11:19AM (#27051013)
Sounds about right. Python 3 demoted reduce from builtin to stdlib because it saw very little use after the introduction of the more common use cases as builtins.