ptal / oak

A typed parser generator embedded in Rust code for Parsing Expression Grammars
Apache License 2.0
142 stars 14 forks source link

Type unification in sum type #46

Closed ptal closed 9 years ago

ptal commented 9 years ago

In a typed context, sums (expr1 / expr2) must always have a name provided by the user. We can relax this constraint if the type of expr1 and expr2 is identical.

But is it really interesting? Is it possible for two distinct branches to have the same type and doing something different that can be factored out of the sum?

ptal commented 9 years ago

This should be automatic, we do not impose the type of expr1 / expr2 to be a sum type but we must constraint expr1 and expr2 to be of the same type. This issue is therefore not relevant.