···11-module ConstSymbol: SExpFunc.SYMBOL = {
11+module ConstSymbol: SExpFunc.SYMBOL with type t = string = {
22 type t = string
33 type subst = Map.t<int, string>
44 let unify = (a, b) =>
···1010 let prettyPrint = (name, ~scope as _: array<string>) => name
1111 let parse = (string, ~scope as _: array<string>, ~gen as _=?) => Ok((string, ""))
1212 let substitute = (name, _) => name
1313+ let constSymbol = name => Some(name)
1314}
14151516include SExpFunc.Make(ConstSymbol)
1616-let symbol = s => s->ConstSymbol.parse(~scope=[])->Result.getExn->Pair.first->Symbol
1717+let pSymbol = s => s->ConstSymbol.parse(~scope=[])->Result.getExn->Pair.first
1818+let symbol = s => s->pSymbol->Symbol
1719let getSymbol = s => s->ConstSymbol.prettyPrint(~scope=[])
+4-1
src/SExp.resi
···11-module ConstSymbol: SExpFunc.SYMBOL
11+// TODO: i only added the with type t = string later.
22+// may remove need for helpers down bottom
33+module ConstSymbol: SExpFunc.SYMBOL with type t = string
2435include module type of SExpFunc.Make(ConstSymbol)
46let symbol: string => t
77+let pSymbol: string => ConstSymbol.t
58let getSymbol: ConstSymbol.t => string
+2
src/SExpFunc.res
···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
88+ // used for grouping judgments together for rule induction
99+ let constSymbol: t => option<string>
810}
9111012module IntCmp = Belt.Id.MakeComparable({
···11-module StringSymbol: SExpFunc.SYMBOL = {
22- type t = StringS(StringTerm.t) | ConstS(SExp.ConstSymbol.t)
11+type stringSymbol = StringS(StringTerm.t) | ConstS(SExp.ConstSymbol.t)
22+33+module StringSymbol: SExpFunc.SYMBOL with type t = stringSymbol = {
44+ type t = stringSymbol
35 type subst = Map.t<int, t>
46 type gen = ref<int>
57 let parse = (s, ~scope, ~gen: option<gen>=?) => {
···3537 }
3638 | ConstS(s) => ConstS(s)
3739 }
4040+ let constSymbol = s =>
4141+ switch s {
4242+ | StringS(_) => None
4343+ | ConstS(s) => SExp.ConstSymbol.constSymbol(s)
4444+ }
3845}
3946module StringSExp = SExpFunc.Make(StringSymbol)
4747+let constSymbol = (s: string): StringSExp.t => StringSExp.Symbol(ConstS(SExp.pSymbol(s)))
40484149let toSExp = (t: StringTerm.t): StringSExp.t => {
4250 let convertPiece = (p: StringTerm.piece): StringSExp.t =>
+4-1
src/StringTermJudgment.resi
···11-module StringSymbol: SExpFunc.SYMBOL
11+type stringSymbol = StringS(StringTerm.t) | ConstS(SExp.ConstSymbol.t)
22+module StringSymbol: SExpFunc.SYMBOL with type t = stringSymbol
33+24module StringSExp: module type of SExpFunc.Make(StringSymbol)
3546type t = (StringTerm.t, StringSExp.t)
77+let constSymbol: string => StringSExp.t
5869include Signatures.JUDGMENT with module Term := StringTerm and type t := t