Better styling for miniFun

This commit is contained in:
elvis
2025-01-27 00:18:23 +01:00
parent 6d5587692c
commit 5e8b339440
3 changed files with 38 additions and 32 deletions

View File

@ -5,7 +5,8 @@ Random.self_init ()
let (let*) = Result.bind
let rec evaluate_type (program: t_exp) (context: ftype VariableMap.t) : (ftype, [> typechecking_error]) result =
let rec evaluate_type (program: t_exp) (context: ftype VariableMap.t) :
(ftype, [> typechecking_error]) result =
match program with
Integer _ -> Ok IntegerType
| Boolean _ -> Ok BooleanType
@ -25,7 +26,8 @@ let rec evaluate_type (program: t_exp) (context: ftype VariableMap.t) : (ftype,
the type of the body using the bindings for the input *)
match typef with
FunctionType (tin, tout) -> (
let* typefbody = evaluate_type fbody (VariableMap.add x tin context) in
let* typefbody = evaluate_type fbody (VariableMap.add x tin context)
in
if (typefbody = tout) then
Ok typef
else