clear binders after each definition (!!!)

This commit is contained in:
William Ball 2024-11-28 14:32:30 -08:00
parent 9afa90d3af
commit 58168e461d

View file

@ -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