remove square brackets around type lines

(parens are needed if they are anything other than a `term arg`)
This commit is contained in:
rhiannon morris 2023-05-16 18:14:42 +02:00
parent d631b86be3
commit 64de93a13c
7 changed files with 42 additions and 35 deletions

View file

@ -245,15 +245,6 @@ export
term : FileName -> Grammar True PTerm
-- defined after all the subterm parsers
export
typeLine : FileName -> Grammar True (PatVar, PTerm)
typeLine fname = do
resC "["
mustWork $ do
i <- patVar fname <* resC "" <|> unused fname
t <- assert_total term fname <* needRes "]"
pure (i, t)
||| box term `[t]` or type `[π.A]`
export
boxTerm : FileName -> Grammar True PTerm
@ -287,6 +278,19 @@ termArg fname = withLoc fname $
<|> [|V qname|]
<|> const <$> tupleTerm fname
export
properTypeLine : FileName -> Grammar True (PatVar, PTerm)
properTypeLine fname = do
resC "("
i <- patVar fname <* resC "" <|> unused fname
t <- assert_total term fname <* needRes ")"
pure (i, t)
export
typeLine : FileName -> Grammar True (PatVar, PTerm)
typeLine fname =
properTypeLine fname <|> [|(,) (unused fname) (termArg fname)|]
||| optionally, two dimension arguments. if absent default to `@0 @1`
private
optDirection : FileName -> Grammar False (PDim, PDim)