gelisam / klister

an implementation of stuck macros
BSD 3-Clause "New" or "Revised" License
128 stars 11 forks source link

type-literals for the later phase #244

Open gelisam opened 1 week ago

gelisam commented 1 week ago

A value of type Type is a type in the later phase (typically a macro executes at phase 1 and manipulates terms and types from phase 0). We can write (the (Maybe Integer) (just 42)) to construct a value of type (Maybe Integer), but we can't write (the Type (Maybe Integer)) to construct a value of type Type, because the Maybe macro is only valid in the type and type-pattern contexts, it is not valid in the expression context.

I propose a macro the-type which can be used this way:

(type-case (the-type (Maybe Integer))
  ...)

The macro the-type would expand (Maybe Integer) in the type context in the later phase (in this example (type-case ...) and (the-type ...) are executing at phase 1, and (Maybe Integer) would be expanded at phase 0).