Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Kind polymorphism #1763
referenced this issue
Jul 23, 2016
I had a bit of a strange idea for an alternative to kind polymorphism.
Instead of adding more machinery to the kind level, we could go the other way and make the type-level language dynamically typed. Here is how this could work:
Of course, this is a bit at odds with other things going on at the moment, namely @LiamGoodacre's work on user-defined kinds, but I think we can incorporate that work at the same time. Specifically, instead of defining the kind of a type, we just declare a type with its tag.
So, what do people think?
I think this has the potential to be really awesome. Coin the term
Though I am wondering how this will play with type classes - I suspect in some (unusual) cases it may be undecidable to select an instance if the type class doesn't have fixed kinds for its arguments - but I need to explore that more and come up with a good example.
@EpicOrange What do you mean by "can't add any constraints to the Exists type"?
@EpicOrange You can have constrained existentials even without using
newtype Boxed = Boxed (∀ r. (∀ a. Show a ⇒ a → r) → r) mkBoxed ∷ ∀ a. Show a ⇒ a → Boxed mkBoxed a = Boxed \unbox → unbox a showBoxed ∷ Boxed → String showBoxed (Boxed f) = f show