AshleyYakeley / Truth

Changes and Pinafore projects. Pull requests not accepted.
https://pinafore.info/
GNU General Public License v2.0
32 stars 0 forks source link

Allow pattern-matching in let-bindings #169

Closed AshleyYakeley closed 1 year ago

AshleyYakeley commented 1 year ago

Currently we have to do this:

f: P *: Q;
let
p: P = f >- fn (p,_) => p;
q: Q = f >- fn (_,q) => q;
in expr;

It would be nice to be able to do something like:

let
(p,q) = f;
in expr;

The problem is that : in pattern-matching now has two different meanings. Consider

g = fn y => let
x: T = y;
in x;

Does g have type T -> T or D(T) -> T?

AshleyYakeley commented 1 year ago
AshleyYakeley commented 1 year ago

If option 2, then :? is the obvious syntax.

AshleyYakeley commented 1 year ago

Done.