Skip to content

Commit

Permalink
Refactoring of TypeInference (#76)
Browse files Browse the repository at this point in the history
- Split large mutually-recursive block in `TypeInference.Expr` into
  several modules: `Def`, `Expr`, `MatchClause` and `PolyExpr`
- The mutual recursion is obtained by recursive first-class module of
  type `TypeCheckFix.tcfix` created in `TypeInference.Main`
- Moved extraction of type hints to separate module
  • Loading branch information
ppolesiuk authored May 3, 2024
1 parent 94002d4 commit 8a600ee
Show file tree
Hide file tree
Showing 14 changed files with 1,182 additions and 929 deletions.
467 changes: 467 additions & 0 deletions src/TypeInference/Def.ml

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions src/TypeInference/Def.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(* This file is part of DBL, released under MIT license.
* See LICENSE for details.
*)

(** Type-inference for definitions *)

open Common
open TypeCheckFix

(** Check type and effect of a single definition. It uses bidirectional
type checking, and pass the extended environment to the body-generating
continuation. *)
val check_def : tcfix:tcfix ->
Env.t -> ImplicitEnv.t -> S.def ->
(T.typ, 'dir) request -> T.effrow -> def_cont ->
T.expr * (T.typ, 'dir) response * ret_effect

(** Check type and effect of a block of definitions. It uses bidirectional
type checking, and pass the extended environment to the body-generating
continuation. *)
val check_defs : tcfix:tcfix ->
Env.t -> ImplicitEnv.t -> S.def list ->
(T.typ, 'dir) request -> T.effrow -> def_cont ->
T.expr * (T.typ, 'dir) response * ret_effect
Loading

0 comments on commit 8a600ee

Please sign in to comment.