summaryrefslogtreecommitdiff
path: root/lambda-calcul/haskell/src/Minilang/Lambda/Infer.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lambda-calcul/haskell/src/Minilang/Lambda/Infer.hs')
-rw-r--r--lambda-calcul/haskell/src/Minilang/Lambda/Infer.hs4
1 files changed, 4 insertions, 0 deletions
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