Qqwy / elixir-type_check

TypeCheck: Fast and flexible runtime type-checking for your Elixir projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow people to write 'type-level functions'

Qqwy opened this issue · comments

In certain cases, it can be very useful to generate types programmatically, potentially based on other pre-existing types.

It would be very nice if people were able to write their own type-level functions akin to the ones currently in TypeCheck.Builtin.

However, this is not a trivial tasks, as currently types are evaluated in a bit of a special context to make sure they can already be used at compile-time inside the module that is being compiled.

To do this we either (a) need access to the imports of the main module, or (b) need to be able to provide special/extra imports to the type-eval module itself. What the best way to do this might be is still up for debate.

Closing this for now; it is expected that for a long time, using 'unquote fragments' if type-metaprogramming is required will be enough.