the next generation of the in-browser educational proof assistant
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix value wrapping

+11 -4
+9 -4
src/AtomDef.res
··· 18 18 module type COERCIBLE_ATOM = { 19 19 include ATOM 20 20 let coerce: hValue => option<t> 21 + let wrap: t => hValue 21 22 } 22 23 23 24 type loweredSExp = Var({idx: int}) | Schematic({schematic: int, allowed: array<int>}) ··· 51 52 | Right(s) => rightBranch(s) 52 53 | Foreign(_) => throw(MatchCombineAtomForeign) 53 54 } 54 - let wrapLeft = left => HValue(Left.Tag, left) 55 - let wrapRight = right => HValue(Right.Tag, right) 55 + let wrap = t => 56 + switch t { 57 + | Left(s) => Left.wrap(s) 58 + | Right(s) => Right.wrap(s) 59 + | Foreign(val) => val 60 + } 56 61 let parse = (s, ~scope, ~gen: option<gen>=?) => { 57 62 Left.parse(s, ~scope, ~gen?) 58 63 ->Result.map(((r, rest)) => (Left(r), rest)) ··· 73 78 let coerceToLeft = (t): option<Left.t> => 74 79 switch t { 75 80 | Left(s) => Some(s) 76 - | Right(s) => s->wrapRight->Left.coerce 81 + | Right(s) => Right.wrap(s)->Left.coerce 77 82 | Foreign(v) => Left.coerce(v) 78 83 } 79 84 let coerceToRight = (t): option<Right.t> => 80 85 switch t { 81 86 | Right(s) => Some(s) 82 - | Left(s) => s->wrapLeft->Right.coerce 87 + | Left(s) => Left.wrap(s)->Right.coerce 83 88 | Foreign(v) => Right.coerce(v) 84 89 } 85 90 let substitute = (s, subst: subst) => {
+2
src/Coercible.res
··· 14 14 ]) 15 15 | _ => None 16 16 } 17 + let wrap = a => HValue(StringA.Atom.Tag, a) 17 18 } 18 19 19 20 module Symbolic: COERCIBLE_ATOM with type t = Symbolic.Atom.t = { 20 21 include Symbolic.Atom 21 22 let coerce = _ => None 23 + let wrap = a => HValue(Symbolic.Atom.Tag, a) 22 24 }