···11module SymbolAtom: SExpFunc.ATOM with type t = string = {
22 type t = string
33 type subst = Map.t<int, string>
44- let unify = (a, b) =>
44+ let unify = (a, b, ~gen as _=?) =>
55 if a == b {
66 Seq.once(Map.make())
77 } else {
···1818 let lowerVar = _ => ""
1919 let lowerSchematic = (_, _) => ""
2020 let ghost = ""
2121- let substDeBruijn = (name, _, ~from as _) => name
2121+ let substDeBruijn = (name, _, ~from as _=?) => name
2222 let unifiesWithAnything = _ => false
2323 let upshift = (t, _, ~from as _=?) => t
2424}
+2-2
src/SExpFunc.res
···11module type ATOM = {
22 type t
33 type subst = Map.t<int, t>
44- let unify: (t, t) => Seq.t<subst>
44+ let unify: (t, t, ~gen: ref<int>=?) => Seq.t<subst>
55 let prettyPrint: (t, ~scope: array<string>) => string
66 let parse: (string, ~scope: array<string>, ~gen: ref<int>=?) => result<(t, string), string>
77 let substitute: (t, subst) => t
···1010 let lowerVar: int => t
1111 let lowerSchematic: (int, array<int>) => t
1212 let ghost: t
1313- let substDeBruijn: (t, array<t>, ~from: int) => t
1313+ let substDeBruijn: (t, array<t>, ~from: int=?) => t
1414 let unifiesWithAnything: t => bool
1515}
1616
···11-type stringAtom = StringS(StringTerm.t) | ConstS(SExp.Atom.t)
22-module StringAtom: SExpFunc.ATOM with type t = stringAtom
11+type stringSExpAtom = StringS(StringAtom.t) | ConstS(SExp.Atom.t)
22+module StringSExpAtom: SExpFunc.ATOM with type t = stringSExpAtom
3344type rec t =
55- | Atom(StringAtom.t)
55+ | Atom(StringSExpAtom.t)
66 | Compound({subexps: array<t>})
77 | Var({idx: int})
88 | Schematic({schematic: int, allowed: array<int>})
···1414 and type schematic = int
1515 and type subst = Map.t<int, t>
16161717-module Atom: SExpFunc.ATOM with type t := StringAtom.t
1717+module Atom: SExpFunc.ATOM with type t := StringSExpAtom.t
1818let mapTerms: (t, t => t) => t
+17
src/StringSExpJView.res
···11+module StringAtomView: SExpViewFunc.ATOM_VIEW with module Atom := StringSExp.StringSExpAtom = {
22+ type props = {name: StringSExp.StringSExpAtom.t, scope: array<string>}
33+ let make = ({name, scope}: props) =>
44+ switch name {
55+ | StringSExp.StringS(name) => <StringAtomView name scope />
66+ | StringSExp.ConstS(name) => <SExpView.ConstAtomView name scope />
77+ }
88+}
99+1010+module View = SExpViewFunc.Make(StringSExp.StringSExpAtom, StringAtomView, StringSExp)
1111+1212+module TermView = View
1313+type props = {
1414+ judgment: StringSExp.t,
1515+ scope: array<string>,
1616+}
1717+let make = ({judgment, scope}) => View.make({term: judgment, scope})
···11-type rec piece =
22- | String(string)
33- | Var({idx: int})
44- | Schematic({schematic: int, allowed: array<int>})
55- | Ghost
66-type t = array<piece>
77-type subst = Map.t<int, t>
88-type gen = ref<int>
99-1010-include Signatures.TERM
1111- with type t := t
1212- and type meta = string
1313- and type schematic = int
1414- and type subst := subst
1515- and type gen := gen
-17
src/StringTermJView.res
···11-module StringAtomView: SExpViewFunc.ATOM_VIEW with module Atom := StringSExp.StringAtom = {
22- type props = {name: StringSExp.StringAtom.t, scope: array<string>}
33- let make = ({name, scope}: props) =>
44- switch name {
55- | StringSExp.StringS(term) => <StringTermView term scope />
66- | StringSExp.ConstS(name) => <SExpView.ConstAtomView name scope />
77- }
88-}
99-1010-module View = SExpViewFunc.Make(StringSExp.StringAtom, StringAtomView, StringSExp)
1111-1212-module TermView = View
1313-type props = {
1414- judgment: StringSExp.t,
1515- scope: array<string>,
1616-}
1717-let make = ({judgment, scope}) => View.make({term: judgment, scope})