Closed GuillaumeGen closed 3 years ago
This makes sense. Originally, I was expecting that we would use the Fact
constraint a little more, hence, Choose
was meant not as in "choose constructor" but "choose execution branch". As it turns out, the ConstraintTree
is used way less than anticipated, which is a good think! :)
Currently the
ConstraintTree
has a nodeChoose
which takes only a list ofMatch x ty c args :&: tr
which means "Ifx
of typety
is the constructorc
, then letargs
be the name of its arguments and outputtr
". This implies that thex
andty
are declared once for each constructors, whereas they should be common to all branches of theChoose
. In particular, ifx
is a complex term, a new free namefn
and a new bindingLET fn == x
is generated in each branch. This PR redesignsConstraintTree
to eliminate this duplication of code.