···1111type meta = string
1212type schematic = int
13131414+module BaseAtom = AtomDef.MakeBaseAtom({
1515+ type t = t
1616+})
1717+1418module Atom = {
1919+ module BaseAtom = BaseAtom
1520 type t = t
1621 type subst = Map.t<schematic, t>
1717- type AtomDef.atomTag<_> += Tag: AtomDef.atomTag<t>
1822 let substitute = (term: t, subst: subst) =>
1923 Array.flatMap(term, piece => {
2024 switch piece {
···458462 let concrete = t =>
459463 t->Array.every(p =>
460464 switch p {
461461- | Schematic(_) => true
462462- | _ => false
465465+ | Schematic(_) => false
466466+ | _ => true
463467 }
464468 )
469469+ let coerce = (AtomDef.AnyValue(tag, a)) =>
470470+ switch tag {
471471+ | Symbolic.BaseAtom.Tag => Some([String(a)])
472472+ | AtomDef.VarBase.Tag =>
473473+ Some([
474474+ switch a {
475475+ | Var({idx}) => Var({idx: idx})
476476+ | Schematic({schematic, allowed}) => Schematic({schematic, allowed})
477477+ },
478478+ ])
479479+ | _ => None
480480+ }
465481}
466482467483module AtomView = {
+2-1
src/StringA.resi
···44 | Schematic({schematic: int, allowed: array<int>})
55type t = array<piece>
6677-module Atom: AtomDef.ATOM with type t = t
77+module BaseAtom: AtomDef.BASE_ATOM with type t = t
88+module Atom: AtomDef.ATOM with module BaseAtom = BaseAtom
89module AtomView: AtomDef.ATOM_VIEW with module Atom := Atom
···11-type t = string
11+module BaseAtom = AtomDef.MakeBaseAtom({
22+ type t = string
33+})
44+25module Atom = {
33- open AtomDef
66+ module BaseAtom = BaseAtom
47 type t = string
58 type subst = Map.t<int, string>
66- type atomTag<_> += Tag: atomTag<t>
79 let unify = (a, b, ~gen as _=?) =>
810 if a == b {
911 Seq.once(Map.make())
···1921 }
2022 let substitute = (name, _) => name
2123 let substDeBruijn = (name, _, ~from as _=?) => name
2222- let concrete = _ => false
2424+ let concrete = _ => true
2325 let upshift = (t, _, ~from as _=?) => t
2626+ let coerce = _ => None
2427}
25282629module AtomView = {
+2-2
src/Symbolic.resi
···11-type t = string
22-module Atom: AtomDef.ATOM with type t = t
11+module BaseAtom: AtomDef.BASE_ATOM with type t = string
22+module Atom: AtomDef.ATOM with module BaseAtom = BaseAtom
33module AtomView: AtomDef.ATOM_VIEW with module Atom := Atom
+13-2
src/Util.res
···143143}
144144145145module Result = {
146146- let ok = (r: result<'a, 'b>): option<'a> =>
146146+ include Result
147147+ type t<'a, 'b> = result<'a, 'b>
148148+ let ok = (r: t<'a, 'b>): option<'a> =>
147149 switch r {
148150 | Ok(a) => Some(a)
149151 | Error(_) => None
150152 }
151151- let or = (r1: result<'a, 'b>, r2: unit => result<'a, 'b>): result<'a, 'b> =>
153153+ let or = (r1: t<'a, 'b>, r2: unit => t<'a, 'b>): t<'a, 'b> =>
152154 switch r1 {
153155 | Ok(_) => r1
154156 | Error(_) => r2()
155157 }
156158}
159159+160160+module Option = {
161161+ include Option
162162+ let getOrElse = (t, f): 'a =>
163163+ switch t {
164164+ | Some(a) => a
165165+ | None => f()
166166+ }
167167+}