drop old record syntax

This commit is contained in:
2026-03-29 10:27:35 -07:00
parent ee9664838f
commit 2f1185bf4c
3 changed files with 4 additions and 15 deletions

View File

@@ -109,7 +109,6 @@ asAtom = do
recordUpdate : Parser Raw
recordUpdate' : Parser Raw
parenTypeExp : Parser Raw
parenTypeExp = do
@@ -127,7 +126,7 @@ atom : Parser Raw
atom = do
pure MkUnit
RU <$> getPos <* keyword "U"
<|> recordUpdate'
<|> recordUpdate
-- <|> RVar <$> getPos <*> ident
<|> asAtom
<|> RVar <$> getPos <*> uident
@@ -136,7 +135,6 @@ atom = do
<|> RImplicit <$> getPos <* keyword "_"
<|> RHole <$> getPos <* keyword "?"
<|> parenTypeExp
<|> recordUpdate
updateClause : Parser UpdateClause
updateClause = do
@@ -148,16 +146,7 @@ updateClause = do
True => pure $ AssignField fc nm tm
_ => pure $ ModifyField fc nm tm
-- ambiguity vs {a} or {a} -> ... is tough, we can do [] or put a keyword in front.
recordUpdate = do
fc <- getPos
symbol "["
clauses <- sepBy (symbol ";") updateClause
symbol "]"
tm <- optional atom
pure $ RUpdateRec fc clauses tm
recordUpdate' = do
fc <- getPos
symbol "{"
clauses <- sepBy (symbol ";") updateClause

View File

@@ -9,4 +9,4 @@ record Bar where
foo : Foo
blah : Bar Bar
blah x = [ foo $= [ bar := 1]] x
blah x = { foo $= { bar := 1}} x

View File

@@ -8,12 +8,12 @@ record Foo where
baz : Nat
blah : Foo Foo
blah x = [ bar := Z ] x
blah x = { bar := Z } x
main : IO Unit
main = do
let x = blah $ MkFoo (S Z) (S (S Z))
printLn x.bar
-- this is unfortunate, it can't get record type from a meta
let x' = the Foo $ [ baz := Z ] x
let x' = the Foo $ { baz := Z } x
printLn x'.baz