News for hackers. Stuff that matters.
Re:The use of `class` for things that should be simple free ... by still_grokking on Thursday May 28, 2020 @04:43AM (#23334946)
So you would not use type-classes in Haskell as they rely on implicitly passed parameters to functions?
Re:The use of `class` for things that should be simple free ... by kqr on Thursday May 28, 2020 @04:50AM (#23334988)
I can't speak for the GP, but what makes typeclasses in Haskell work for me is that there's a very strong cultural force ensuring that they are truly about consistency boundaries and maintaining invariants/laws.

Haskell developers don't just create a typeclass to bunch related functionality together. Doing so is a common beginner's anti-pattern. Typeclasses exist to wrap up general operations that satisfy some laws.

When objects in OOP are used in the same way, I don't mind it as much. It's when they're not that I don't find the syntactic inconvenience worth it.

Re:The use of `class` for things that should be simple free ... by js8 on Thursday May 28, 2020 @05:57AM (#23335473)
In Haskell typeclasses, it's the type of the parameter that is implicitly passed, not the parameter itself.
Re:The use of `class` for things that should be simple free ... by uryga on Thursday May 28, 2020 @06:09AM (#23335546)
i don't think that's correct, afaik typeclasses roughly desugar to passing a record of functions (vtable/"dictionary") at the call site
Re:The use of `class` for things that should be simple free ... by taejo on Thursday May 28, 2020 @06:31AM (#23335684)
And that vtable depends on the type, not the value.
Re:The use of `class` for things that should be simple free ... by uryga on Thursday May 28, 2020 @12:36PM (#23339301)
i guess there's really two implicit arguments - the value's type, `a` (quantified via forall - the System F "Λ") and its vtable `Show a`... though i guess the vtable is uniquely determined by the type bc in Haskell instances are globally unique