change record update syntax
This commit is contained in:
@@ -28,7 +28,7 @@ parenWrap pa = do
|
|||||||
pure t
|
pure t
|
||||||
|
|
||||||
braces : ∀ a. Parser a -> Parser a
|
braces : ∀ a. Parser a -> Parser a
|
||||||
braces pa = do
|
braces pa = try $ do
|
||||||
symbol "{"
|
symbol "{"
|
||||||
t <- pa
|
t <- pa
|
||||||
symbol "}"
|
symbol "}"
|
||||||
@@ -107,8 +107,9 @@ asAtom = do
|
|||||||
Just exp => pure $ RAs fc nm exp
|
Just exp => pure $ RAs fc nm exp
|
||||||
Nothing => pure $ RVar fc nm
|
Nothing => pure $ RVar fc nm
|
||||||
|
|
||||||
-- the inside of Raw
|
|
||||||
recordUpdate : Parser Raw
|
recordUpdate : Parser Raw
|
||||||
|
recordUpdate' : Parser Raw
|
||||||
|
|
||||||
parenTypeExp : Parser Raw
|
parenTypeExp : Parser Raw
|
||||||
parenTypeExp = do
|
parenTypeExp = do
|
||||||
@@ -126,6 +127,7 @@ atom : Parser Raw
|
|||||||
atom = do
|
atom = do
|
||||||
pure MkUnit
|
pure MkUnit
|
||||||
RU <$> getPos <* keyword "U"
|
RU <$> getPos <* keyword "U"
|
||||||
|
<|> recordUpdate'
|
||||||
-- <|> RVar <$> getPos <*> ident
|
-- <|> RVar <$> getPos <*> ident
|
||||||
<|> asAtom
|
<|> asAtom
|
||||||
<|> RVar <$> getPos <*> uident
|
<|> RVar <$> getPos <*> uident
|
||||||
@@ -155,6 +157,15 @@ recordUpdate = do
|
|||||||
tm <- optional atom
|
tm <- optional atom
|
||||||
pure $ RUpdateRec fc clauses tm
|
pure $ RUpdateRec fc clauses tm
|
||||||
|
|
||||||
|
recordUpdate' = do
|
||||||
|
fc <- getPos
|
||||||
|
symbol "{"
|
||||||
|
clauses <- sepBy (symbol ";") updateClause
|
||||||
|
symbol "}"
|
||||||
|
tm <- optional atom
|
||||||
|
pure $ RUpdateRec fc clauses tm
|
||||||
|
|
||||||
|
|
||||||
-- Argument to a Spine
|
-- Argument to a Spine
|
||||||
pArg : Parser (Icit × FC × Raw)
|
pArg : Parser (Icit × FC × Raw)
|
||||||
pArg = do
|
pArg = do
|
||||||
@@ -454,11 +465,14 @@ ebind = do
|
|||||||
|
|
||||||
ibind : Parser Telescope
|
ibind : Parser Telescope
|
||||||
ibind = do
|
ibind = do
|
||||||
-- I've gone back and forth on this, but I think {m a b} is more useful than {Int}
|
-- we don't know if it's an ibind or record update until we hit the `:`
|
||||||
symbol "{"
|
(quant, names) <- try $ do
|
||||||
quant <- quantity
|
symbol "{"
|
||||||
names <- (some (addPos varname))
|
quant <- quantity
|
||||||
ty <- symbol ":" *> typeExpr
|
names <- (some (addPos varname))
|
||||||
|
symbol ":"
|
||||||
|
pure (quant, names)
|
||||||
|
ty <- typeExpr
|
||||||
symbol "}"
|
symbol "}"
|
||||||
pure $ map (makeBind quant (Just ty)) names
|
pure $ map (makeBind quant (Just ty)) names
|
||||||
where
|
where
|
||||||
|
|||||||
Reference in New Issue
Block a user