diff options
author | Csaba Hruska <csaba.hruska@gmail.com> | 2015-12-11 14:59:34 +0100 |
---|---|---|
committer | Csaba Hruska <csaba.hruska@gmail.com> | 2015-12-11 14:59:34 +0100 |
commit | 4eb342795e2401290c97a8b4ee129b6d1ed182be (patch) | |
tree | cdc193c12d43171457b4979a444582a60ee518d0 /prototypes | |
parent | ad5cec8ccd47297d3e89d1dd8b82775e0e9c99a7 (diff) |
support data record value syntax
Diffstat (limited to 'prototypes')
-rw-r--r-- | prototypes/Infer.hs | 7 | ||||
l--------- | prototypes/tests/accept/Material.lc | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/prototypes/Infer.hs b/prototypes/Infer.hs index 8cd060d5..1bdaffe0 100644 --- a/prototypes/Infer.hs +++ b/prototypes/Infer.hs | |||
@@ -1464,9 +1464,12 @@ parseTerm ns PrecOp e = (asks $ \dcls -> calculatePrecs dcls e) <*> p' where | |||
1464 | p op = do (exp, op') <- try ((,) <$> parseTerm ns PrecApp e <*> operator') | 1464 | p op = do (exp, op') <- try ((,) <$> parseTerm ns PrecApp e <*> operator') |
1465 | ((op, exp):) <$> p op' | 1465 | ((op, exp):) <$> p op' |
1466 | <|> pure . (,) op <$> parseTerm ns PrecLam e | 1466 | <|> pure . (,) op <$> parseTerm ns PrecLam e |
1467 | parseTerm ns PrecApp e = foldl sapp <$> parseTerm ns PrecAtom e <*> many | 1467 | parseTerm ns PrecApp e = |
1468 | try {- TODO: adjust try for better error messages e.g. don't use braces -} | ||
1469 | (foldl sapp <$> (sVar e <$> upperCaseIdent ns) <*> braces (commaSep $ lcIdents ns *> operator "=" *> ((,) Visible <$> parseTerm ns PrecAtom e))) <|> | ||
1470 | (foldl sapp <$> parseTerm ns PrecAtom e <*> many | ||
1468 | ( (,) Visible <$> parseTerm ns PrecAtom e | 1471 | ( (,) Visible <$> parseTerm ns PrecAtom e |
1469 | <|> (,) Hidden <$ operator "@" <*> parseTTerm ns PrecAtom e) | 1472 | <|> (,) Hidden <$ operator "@" <*> parseTTerm ns PrecAtom e)) |
1470 | parseTerm ns PrecAtom e = | 1473 | parseTerm ns PrecAtom e = |
1471 | sLit . LChar <$> charLiteral | 1474 | sLit . LChar <$> charLiteral |
1472 | <|> sLit . LString <$> stringLiteral | 1475 | <|> sLit . LString <$> stringLiteral |
diff --git a/prototypes/tests/accept/Material.lc b/prototypes/tests/accept/Material.lc new file mode 120000 index 00000000..828663d7 --- /dev/null +++ b/prototypes/tests/accept/Material.lc | |||
@@ -0,0 +1 @@ | |||
/Users/csaba/haskell/lc/lambdacube-compiler/tests/accept/Material.lc \ No newline at end of file | |||