Conversation

> classes as a subset of types Yeah, that's another way to look at it, and really good one. Thanks Chris! > Functor is a collection of classes Well, if a class (* -> *) is collection of types, then Functor ((* -> *) -> *) feels more like collection of classes.
2
(* -> *) isn't a class, though. That's a type constructor (or a type family, etc.). If you want to think of a type class as mapping a type to something, then it maps types to *values*. This is something you can't really express in Haskell directly.
1
1
I see.. I mix up `class` and `data` construct of Haskell, I guess. Can you point to thing in which I can express it (Idris 🤔) or related material?
1
Great question! Idris lets types depend on values, but values that depend on types are just plain polymorphism, and actually many languages do that! To define an arbitrary map from types to values is "ad hoc polymorphism". Haskell can actually do that... using type classes.
2
1
Oh yes, that's polymorphism. I can't help but wonder whether we have a concept of first-class polymorphism? Hmm.. I think, almost all the languages have special construct for polymorphism, e.g. Haskell's `class`.. Would it be beneficial to have them as first-class entity? 🤔
2
according your code snippet, I think type class (ad hoc polymorphism) going to be first-class in Pikelet, correct? being a function type? Maybe I'm again mixing it up! 😬What do you think about first-class polymorphism?
1
> Not sure what you mean by ‘first class polymorphism’. neither am I 🙂 But, yes I think more like 1ML, not the MLton thing! Maybe I need to do some homework before asking more questions.
1
1