From bf851ab8fb867cb7d8918686b5a1974738abf506 Mon Sep 17 00:00:00 2001 From: jmcardon Date: Wed, 5 Feb 2025 17:24:14 -0500 Subject: [PATCH] remove printing unit values in repl output --- pact-repl/Pact/Core/Repl.hs | 1 - pact-repl/Pact/Core/Repl/Compile.hs | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pact-repl/Pact/Core/Repl.hs b/pact-repl/Pact/Core/Repl.hs index 3632a81c..ea75dc2e 100644 --- a/pact-repl/Pact/Core/Repl.hs +++ b/pact-repl/Pact/Core/Repl.hs @@ -69,7 +69,6 @@ renderLocatedPactErrorFromState rstate err = rendered Nothing -> rstate ^. replCurrSource rendered = replError originFile err - runRepl :: IO () runRepl = do pdb <- mockPactDb serialisePact_repl_fileLocSpanInfo diff --git a/pact-repl/Pact/Core/Repl/Compile.hs b/pact-repl/Pact/Core/Repl/Compile.hs index 9b9181ab..7df03e89 100644 --- a/pact-repl/Pact/Core/Repl/Compile.hs +++ b/pact-repl/Pact/Core/Repl/Compile.hs @@ -54,6 +54,7 @@ import Pact.Core.Errors import Pact.Core.Interpreter import Pact.Core.Pretty hiding (pipe) import Pact.Core.Serialise +import Pact.Core.PactValue import Pact.Core.IR.Eval.Runtime @@ -263,6 +264,8 @@ interpretReplProgram interpreter sc@(SourceCode sourceFp source) = do parseSource lexerOutput | sourceIsPactFile = (fmap.fmap) (Lisp.RTLTopLevel) $ Lisp.parseProgram lexerOutput | otherwise = Lisp.parseReplProgram lexerOutput + displayValue :: FileLocSpanInfo -> ReplCompileValue -> ReplM ReplCoreBuiltin ReplCompileValue + displayValue _info v@(RCompileValue (InterpretValue PUnit _)) = pure v displayValue info p = p <$ replPrintLn info p sliceCode = \case Lisp.TLModule{} -> sliceFromSource @@ -290,10 +293,9 @@ interpretReplProgram interpreter sc@(SourceCode sourceFp source) = do throwExecutionError varI $ EvalError "repl invariant violated: resolved to a top level free variable without a binder" _ -> do let sliced = sliceCode toplevel source (view spanInfo tlInfo) - v <- evalTopLevel interpreter (RawCode sliced) ds deps + v <- RCompileValue <$> evalTopLevel interpreter (RawCode sliced) ds deps emitWarnings - replPrintLn tlInfo v - pure (RCompileValue v) + displayValue tlInfo v where tlInfo = view Lisp.topLevelInfo toplevel _ -> do