fmease / lushui

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

Sigma types #34

Open fmease opened 4 years ago

fmease commented 4 years ago

They are just are library type except that we also provide syntactic sugar for them (I think we should). Definition (depends on #2):

data Sigma (A: Type) (P: A -> Type): Type =
    sigma (,A: Type) (,P: A -> Type)
        (a: A) (proof: P a): Sigma A P

The syntactic sugar is not entirely clear but this is the current proposal:

Note that we should not naïvely translate to the above path to the sigma type defined in core but intelligently to the actual resolved binding (and rise an error if core is not available (as a module or in the future as a crate #14)).

The most important blocker or at least the first to encounter is the question of precedence and associativity to be able to connect it to the rest of the grammar.