cur
cur copied to clipboard
Typeclass constraints?
Typeclass constraints would really improve your typeclasses.
Current typeclass implementation is stupid. Here is a better design:
Export a =>
form for typeclass constraints. It should cooperate with lambda/application to check that arguments satisfy the constraint. This will require more support from lambda/application to enable cooperation.
Each typeclass should export an identifier with associate properties about how it must be implemented. These should be associated with the identifier, much like Racket struct properties, not stored in a hashtable as currently implemented. This should enable typeclasses based on abstract types and return types.
Each implementation should attach properties, like above, to the identifier for the type being implemented.
The latter two properties may be impossible in the current design of Cur, as identifiers aren't real.