pietervdvn / Lang

Yet another programming language
1 stars 1 forks source link

Improve pattern syntax for deconstructors #44

Open pietervdvn opened 9 years ago

pietervdvn commented 9 years ago

Implement guards

f : a -> a -> a
|(>=2) b  = b
_ b          = b

max : (a:Ord) -> a -> a
a |(<a)   = a   -- first arg= a; take this clause if second arg (<a)
_ b         = b

Guards should work both for booleans and Maybe ()

Implement deconstructor expressions

f : { Int --> v } -> v
((lookup 0) v)  = v
dict                  = ...