fmease / lushui

The reference compiler of the Lushui programming language
Apache License 2.0
5 stars 0 forks source link

Language support for the universe pattern #46

Closed fmease closed 2 years ago

fmease commented 3 years ago

Instead of this kind of boilerplate:

data U0: Type =
    int: U0
    text: U0
    option: U0 -> U0

interpret (u: U0): Type =
    case u of
        U0.int => Int
        U0.text => Text
        U0.option \u => Option (interpret u)

We might want to have some syntactic sugar like this:

@(universe interpret)
data U0: Type =
    int = Int
    text = Text
    option = Option
fmease commented 2 years ago

Hmm, very specific...

fmease commented 2 years ago

Scope creep, too niche, could be rendered obsolete if we decide to allow pattern matching on (erased) types.