On Fri, May 1, 2015 at 11:34 PM, Keean Schupke <ke...@fry-it.com> wrote: > On 2 May 2015 03:44, "Matt Oliveri" <atma...@gmail.com> wrote: >> > Interestingly type-classes are related to Prolog clauses, where clause >> > heads >> > are like instance definitions and are globally unique. This is where you >> > go >> > if you follow the argument to it conclusion and get rid of first class >> > functions. >> >> I don't think anyone has made an argument that would get rid of first >> class functions if followed to its conclusion. > > One of the arguments in the video was that type-classes with global > coherence represent a better way of dealing with function arguments. 95% of > the time it was better not to factor out the argument and make the function > dependent on it.
Hmm, what I remember is he was comparing typeclasses to ML modules, and saying that typeclasses were more convenient for 95% of the code. I don't know if this is what you're saying. You need to keep in mind that the usefulness of typeclasses in Haskell is partially that it complements explicit function arguments. It seems plausible to me that typeclasses but no first-class functions would be miserable. > This makes you wonder what a language that makes every > function get passed like a type-class, Makes me wonder? Nope, as a matter of fact, it didn't. ;) > and the answer is you would get > something like Prolog, I'll take your word for it. > but Prolog also exchanges types for values, such that > Prolog clause head matching is more like a value-class. I guess what you're trying to say that the kind of resolution Prolog does is like typeclass instance resolution, except not at the type level. That makes sense. > What is interesting > is that Prolog is not totally useless. Prolog programs should have the same > global structure properties that were presented as preferential in the > video. Well I dunno. Maybe. I don't know all that much about typeclasses or logic programming. But you'd have a hard time getting me to write anything serious in Prolog. And I rather doubt that this is what the guy in the video had in mind. Thank you for explaining what you meant. I think it's crucial to keep in mind that coherent typeclasses complement other mechanisms for organizing code. I don't see anyone trying to sell typeclasses as a cure-all. Especially not me, since I'm still not all that clear on how it helps. _______________________________________________ bitc-dev mailing list bitc-dev@coyotos.org http://www.coyotos.org/mailman/listinfo/bitc-dev