From 58168e461def5f300f5d50635278bf8f57b63b31 Mon Sep 17 00:00:00 2001 From: William Ball Date: Thu, 28 Nov 2024 14:32:30 -0800 Subject: [PATCH] clear binders after each definition (!!!) --- lib/Parser.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Parser.hs b/lib/Parser.hs index f272648..c4d5c44 100644 --- a/lib/Parser.hs +++ b/lib/Parser.hs @@ -66,7 +66,7 @@ pVar :: Parser Expr pVar = label "variable" $ lexeme $ do name <- pIdentifier binders <- view bindsL <$> get - pure (Var name . fromIntegral <$> elemIndex name binders ?: Free name) + pure $ Var name . fromIntegral <$> elemIndex name binders ?: Free name defChoice :: NonEmpty Text -> Parser () defChoice options = lexeme $ label (T.unpack $ head options) $ void $ choice $ fmap chunk options @@ -179,7 +179,7 @@ pBody params ident ascription = do eat ";" pDef :: Parser () -pDef = lexeme $ label "definition" $ do +pDef = lexeme $ label "definition" $ withBinders $ do skipSpace ident <- pIdentifier params <- pManyParams