News for hackers. Stuff that matters.
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