diff --git a/src/Method.res b/src/Method.res index 81cd8e7..0d5c7f1 100644 --- a/src/Method.res +++ b/src/Method.res @@ -201,7 +201,7 @@ module Derivation = (Term: TERM, Judgment: JUDGMENT with module Term := Term) => // pollute TERM with another method for printing bare meta let metaWithoutDot = metaS->String.slice(~start=0, ~end=String.length(metaS) - 1) - `${metaWithoutDot} |-> ${Term.prettyPrint(x, ~scope=ctx.fixes)}` + `${metaWithoutDot} ↦ ${Term.prettyPrint(x, ~scope=ctx.fixes)}` }, ) ->Array.join(", ") diff --git a/src/SExpView.res b/src/SExpView.res index ee75ae6..aca1850 100644 --- a/src/SExpView.res +++ b/src/SExpView.res @@ -43,33 +43,47 @@ module Make = ( } ) - @react.componentWithProps - let rec make = ({term, scope}) => - switch term { - | Compound({subexps: bits}) => - - {bits - ->Array.mapWithIndex((t, i) => React.createElement(make, withKey({term: t, scope}, i))) - ->intersperse - ->parenthesise - ->React.array} - - | Var({idx}) => viewVar({idx, scope}) - | Atom(atom) => - - - - | Schematic({schematic: s, allowed: vs}) => - - {React.string("?")} - {React.int(s)} - - {vs - ->Array.mapWithIndex((v, i) => React.createElement(viewVar, withKey({idx: v, scope}, i))) + module rec Inner: { + @react.component + let make: (~term: SExp.t, ~scope: array, ~parens: bool=?) => React.component + } = { + @react.component + let make = (~term: SExp.t, ~scope: array, ~parens: bool=true) => + switch term { + | Compound({subexps: bits}) => + + {bits + ->Array.mapWithIndex((t, i) => Int.toString} />) ->intersperse - ->parenthesise + ->(a => + if parens { + parenthesise(a) + } else { + a + }) ->React.array} - - } + | Var({idx}) => viewVar({idx, scope}) + | Atom(atom) => + + + + | Schematic({schematic: s, allowed: vs}) => + + {React.string("?")} + {React.int(s)} + + {vs + ->Array.mapWithIndex((v, i) => + React.createElement(viewVar, withKey({idx: v, scope}, i)) + ) + ->intersperse + ->parenthesise + ->React.array} + + + } + } + @react.componentWithProps + let make = ({term, scope}) => }