From 106831f461d6c6291d2f5672893e66aeb1f4698c Mon Sep 17 00:00:00 2001 From: s-kybound Date: Mon, 15 Apr 2024 14:39:45 +0800 Subject: [PATCH] fix output of repl --- src/repl/utils.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/repl/utils.ts b/src/repl/utils.ts index 905b14988..bd4ddeeb7 100644 --- a/src/repl/utils.ts +++ b/src/repl/utils.ts @@ -66,13 +66,14 @@ export function validChapterVariant(language: Language) { export function handleResult(result: Result, context: Context, verboseErrors: boolean) { if (result.status === 'finished' || result.status === 'suspended-non-det') { - if ( - result instanceof Closure || - typeof result === 'function' || - result.representation !== undefined - ) { - return result.toString() + if (result.representation !== undefined) { + return result.representation } + + if (result.value instanceof Closure || typeof result.value === 'function') { + return result.value.toString() + } + return stringify(result.value) }