Newt - a dependent typed programming language

fix parse issue for typed lamda arguments

+11 -16
+4 -16
src/Lib/Parser.newt
··· 285 285 pure (name,fc,ty,t) 286 286 287 287 pLamArg : Parser (Icit × String × Maybe Raw) 288 - pLamArg = impArg <|> autoArg <|> expArg 288 + pLamArg = impArg <|> expArg 289 289 <|> (\ x => (Explicit, x, Nothing)) <$> (ident <|> uident) 290 290 <|> keyword "_" *> pure (Explicit, "_", Nothing) 291 291 where 292 + -- TODO - we're moving away from uppercase variables, but a test uses them 292 293 impArg : Parser (Icit × String × Maybe Raw) 293 - impArg = do 294 - nm <- braces (ident <|> uident) 295 - ty <- optional (symbol ":" >> typeExpr) 296 - pure (Implicit, nm, ty) 297 - 298 - autoArg : Parser (Icit × String × Maybe Raw) 299 - autoArg = do 300 - nm <- dbraces (ident <|> uident) 301 - ty <- optional (symbol ":" >> typeExpr) 302 - pure (Auto, nm, ty) 294 + impArg = (Implicit, ) <$> braces (_,_ <$> (ident <|> uident) <*> optional (symbol ":" >> typeExpr)) 303 295 304 296 expArg : Parser (Icit × String × Maybe Raw) 305 - expArg = do 306 - nm <- parenWrap (ident <|> uident) 307 - -- FIXME - this is broken, outside parenWrap, guess I never used it? 308 - ty <- optional (symbol ":" >> typeExpr) 309 - pure (Explicit, nm, ty) 297 + expArg = (Explicit , ) <$> parenWrap (_,_ <$> ident <*> optional (symbol ":" >> typeExpr)) 310 298 311 299 lamExpr : Parser Raw 312 300 lamExpr = do
+7
tests/LambdaArg.newt
··· 1 + module LambdaArg 2 + 3 + import Prelude 4 + 5 + -- Parsing of typed arguments on lambda 6 + foo : Nat -> ({_ : U} -> Nat -> Nat) 7 + foo x = \ {x : U} (x : Nat) => x