Constraining generic types arguments #99
Replies: 4 comments 5 replies
-
some idea for traits in aiken |
Beta Was this translation helpful? Give feedback.
-
This would be useful. I would immediately write custom Eq trait for |
Beta Was this translation helpful? Give feedback.
-
I've added most of the scaffolding in code gen to support traits for types. It would mainly be now adding it to the front end of the compiler and then hooking it up to code gen at this point. Not a small task, but a lot of progress has been made. |
Beta Was this translation helpful? Give feedback.
-
Bump for last message to be seen. |
Beta Was this translation helpful? Give feedback.
-
While working on the standard library today, we realize that we currently have no ways to specify basic constraints on generic types. For example, how to implement a
sort
function on generic lists?An option is to basically "do nothing" with the compiler and inline the constraint as argument, for example:
but this is sub-optimal because quite noisy for the developer. We might want to explore a concept of Trait or Type-Class for tacking this nicely.
Beta Was this translation helpful? Give feedback.
All reactions