[Ur] First-Class Polymorphism example

Marc Weber marco-oweber at gmx.de
Thu Apr 5 09:59:47 EDT 2012


> You're not far from a correct solution.
Thanks - finally getting this piece feel so good :)

You should consider adding this as "optimization" to the tutorial because it
explains what @@ is about and it makes the example even nicer.

What about kind polymorphic type level functions?

  con my_id :: K --> K -> K
            = K1 ==> fn t :: K1 => t

  con my_id_2 = my_id my_id
  con my_id_3 = my_id

  gives errors:
  main.ur|130| 130:24: Some kind unification variables are undetermined in declaration

This seems to work?
  Got it, it requires type annotations:
  con my_idX :: K --> K -> K = K ==> my_id
  con my_idY :: K --> K -> K = K ==> my_id my_id

So trivial assignment is not guaranteed to work.
I'm pretty sure this also is a very nice example..

Next thing I want to understand how fold and folder cooperate..

Marc Weber



More information about the Ur mailing list