From b87d5b45110cd7efe7109dd6d4e9c19ef28522aa Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Thu, 6 Nov 2025 08:35:36 +0100 Subject: evaluate terms when defining them --- lambda-calcul/haskell/src/Minilang/Lambda/Infer.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lambda-calcul/haskell/src/Minilang/Lambda/Infer.hs') diff --git a/lambda-calcul/haskell/src/Minilang/Lambda/Infer.hs b/lambda-calcul/haskell/src/Minilang/Lambda/Infer.hs index ab590c6..2052398 100644 --- a/lambda-calcul/haskell/src/Minilang/Lambda/Infer.hs +++ b/lambda-calcul/haskell/src/Minilang/Lambda/Infer.hs @@ -61,6 +61,10 @@ data Context = Context } deriving (Eq, Show, Generic, ToJSON, FromJSON) +extendContext :: Text -> Type -> Context -> Context +extendContext x ty (Context n env) = + Context n (Map.insert x ty env) + annotate :: Eval.Term -> Either TypeError (ATerm Type) annotate t = evalStateT (go (fromTerm t) []) newContext -- cgit v1.3.1