News for hackers. Stuff that matters.
Re:When FP? And When OOP? (2013) by pdpi on Monday January 28, 2019 @07:14AM (#19016875)
Haskell's typeclasses (or, equivalently, traits in Rust) help a lot with this problem, though. It's one of the biggest language features I wish I had access to in more languages.
Re:When FP? And When OOP? (2013) by chriswarbo on Monday January 28, 2019 @12:04PM (#19019055)
Haskell type classes are great for most situations, except when they fail it can be quite spectacular. I think the "magic" of type classes comes from two things:

- All instances are thrown into one global namespace, so we don't need to worry about where to find the right one.

- There can be at most one instance per type. Hence there's no ambiguity about which one to pick.

These make it easy for the machine to pick the correct instance automatically. Unfortunately, it also means that every time we import or upgrade a library, there's the chance that it will break things by exposing an instance that clashes with what we have.

The "backpack" stuff looks interesting in this regard, although it seems very over-engineered (mostly due to legacy concerns).

Re:When FP? And When OOP? (2013) by 0db532a0 on Monday January 28, 2019 @02:35PM (#19020343)
What is backpack stuff?
Re:When FP? And When OOP? (2013) by sideeffffect on Monday January 28, 2019 @07:39PM (#19022643)
Re:When FP? And When OOP? (2013) by 0db532a0 on Tuesday January 29, 2019 @12:33PM (#19028163)
Oh thank goodness. Finally.