From 44c88b4c658dbc09b8a3eb37260c8d30d124a692 Mon Sep 17 00:00:00 2001 From: Josh Brown Date: Fri, 15 May 2026 11:42:39 +1000 Subject: [PATCH] aesthetic changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remove outermost parens in SExpressions in line with higher order terms - use unicode ↦ in introduction options rather than plain text |-> - use unicode ε instead of "" for empty strings --- src/Method.res | 2 +- src/SExpView.res | 66 +++++++++++++++++++++++++++++------------------- 2 files changed, 41 insertions(+), 27 deletions(-) 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}) => } -- 2.51.2