tangled
alpha
login
or
join now
dunhamsteve.bsky.social
/
newt
1
fork
atom
Newt - a dependent typed programming language
1
fork
atom
overview
issues
pulls
pipelines
fix parse issue for typed lamda arguments
dunhamsteve.bsky.social
3 weeks ago
0d974dd4
7a763bf4
+11
-16
2 changed files
expand all
collapse all
unified
split
src
Lib
Parser.newt
tests
LambdaArg.newt
+4
-16
src/Lib/Parser.newt
···
285
285
pure (name,fc,ty,t)
286
286
287
287
pLamArg : Parser (Icit × String × Maybe Raw)
288
288
-
pLamArg = impArg <|> autoArg <|> expArg
288
288
+
pLamArg = impArg <|> expArg
289
289
<|> (\ x => (Explicit, x, Nothing)) <$> (ident <|> uident)
290
290
<|> keyword "_" *> pure (Explicit, "_", Nothing)
291
291
where
292
292
+
-- TODO - we're moving away from uppercase variables, but a test uses them
292
293
impArg : Parser (Icit × String × Maybe Raw)
293
293
-
impArg = do
294
294
-
nm <- braces (ident <|> uident)
295
295
-
ty <- optional (symbol ":" >> typeExpr)
296
296
-
pure (Implicit, nm, ty)
297
297
-
298
298
-
autoArg : Parser (Icit × String × Maybe Raw)
299
299
-
autoArg = do
300
300
-
nm <- dbraces (ident <|> uident)
301
301
-
ty <- optional (symbol ":" >> typeExpr)
302
302
-
pure (Auto, nm, ty)
294
294
+
impArg = (Implicit, ) <$> braces (_,_ <$> (ident <|> uident) <*> optional (symbol ":" >> typeExpr))
303
295
304
296
expArg : Parser (Icit × String × Maybe Raw)
305
305
-
expArg = do
306
306
-
nm <- parenWrap (ident <|> uident)
307
307
-
-- FIXME - this is broken, outside parenWrap, guess I never used it?
308
308
-
ty <- optional (symbol ":" >> typeExpr)
309
309
-
pure (Explicit, nm, ty)
297
297
+
expArg = (Explicit , ) <$> parenWrap (_,_ <$> ident <*> optional (symbol ":" >> typeExpr))
310
298
311
299
lamExpr : Parser Raw
312
300
lamExpr = do
+7
tests/LambdaArg.newt
···
1
1
+
module LambdaArg
2
2
+
3
3
+
import Prelude
4
4
+
5
5
+
-- Parsing of typed arguments on lambda
6
6
+
foo : Nat -> ({_ : U} -> Nat -> Nat)
7
7
+
foo x = \ {x : U} (x : Nat) => x