Skip to content

Commit

Permalink
starting to support boundary-sensitive rules (#12)
Browse files Browse the repository at this point in the history
(but I need disjunction to use this!)
  • Loading branch information
jonsterling committed Apr 5, 2021
1 parent 946288c commit 3ddd46f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
35 changes: 32 additions & 3 deletions core/Rule.ml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
open Basis
open Syntax
open Effect

type tp_rule = ltp L.m
type chk_rule = gtp -> ltm L.m
type syn_rule = gtm L.m

type chk_rule =
| Chk of (gtp -> ltm L.m)
| BChk of (gtp -> ltm part -> ltm L.m)


type tele_rule = (string list * ltele) L.m

module TpRule =
Expand All @@ -17,8 +22,32 @@ end
module ChkRule =
struct
type t = chk_rule
let rule x = x
let run x = x
let rule x = Chk x
let brule x = BChk x

let run =
function
| Chk x -> x
| BChk bchk ->
fun tp ->
bchk tp @@
Prt {supp = PBot; part = LAbort; env = Env.empty}

let brun =
let open Monad.Notation (L) in
function
| Chk chk ->
fun tp (Prt part) ->
let* ltm = chk tp in
let* () =
L.scope_thy (`Ext part.supp) @@
let* gtm = Eval.eval ltm in
let* gtm' = Eval.eval part.part in
Equate.equate_gtm tp gtm gtm'
in
L.ret ltm
| BChk bchk ->
bchk
end

module SynRule =
Expand Down
3 changes: 3 additions & 0 deletions core/Rule.mli
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ end
module ChkRule : sig
type t = chk_rule
val rule : (gtp -> ltm L.m) -> t
val brule : (gtp -> ltm part -> ltm L.m) -> t

val run : t -> (gtp -> ltm L.m)
val brun : t -> (gtp -> ltm part -> ltm L.m)
end

module SynRule : sig
Expand Down

0 comments on commit 3ddd46f

Please sign in to comment.