Investigate Data unification
mlhaufe opened this issue · 2 comments
mlhaufe commented
Unification is currently implemented as a part of pattern matching in traits.
What if this was lifted into something more first class? What would it enable?
example:
const Point2 = Data({x: Number, y: Number})
const pt1 = Point2(12, _),
pt2 = Point2(_, 3)
const pt3 = unify(pt1, pt2)
pt3 === Point2(12, 3)
mlhaufe commented
With lazy fields this opens up even more interesting possibilities:
const foo = S({ left: _, right: () => foo })
Is there some logic programming functionality this enables?