list type classes - PureScript

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Mason Mackaman

@miles I just watched your video on the list API cleanup (I actually didn't have time to watch before I joined in the meetup). In the video you say it "seems generally ill-advised to make these monster type classes", but that it's okay because you're not exposing them to the user and just using them for testing. It got me thinking - I don't actually know why it's ill-advised to make monster type classes like that, but my intuition tells me that if there is a good reason not to do it in this case, it would apply across the board. In other words, it would think that it would either be both bad to expose them to the user and to use that as an approach for testing, or both a good approach to testing and something that would be a good API for the user. I for one feel like it would be a nice experience to have polymorphic functions that work over any linear data structure, so that if I realize I want to use a different one I can just change the type signature, but I wouldn't be surprised if there's a good reason that doesn't exist. I'm curious if you (or anyone else) knows why it would be a bad user API while also being the correct approach to testing.

miles

I don't have the best handle on why "overuse" of typeclasses as interfaces is a bad idea, but can point to some articles that make some arguments against it.
https://harry.garrood.me/blog/down-with-show-part-1/ (there are additional links in there).
There's some more discussion about using typeclasses as interfaces for PS collections in https://github.com/purescript/purescript-lists/issues/184

There's a lot in common among containers such as List, Array, Set, but their APIs drift out of sync. What's a good strategy to keep everything up to date? We could continue to apply techniq...