From 8e3d03e55793b49dc6844b23877c84d111e8d7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 13 Sep 2025 21:35:02 +0200 Subject: Get call stack information from function application --- src/Output.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/Output.hs') diff --git a/src/Output.hs b/src/Output.hs index f8ce41d..0ad1f12 100644 --- a/src/Output.hs +++ b/src/Output.hs @@ -167,15 +167,15 @@ outLine otype prompt line = ioWithOutput $ \out -> normalOutputLines :: OutputType -> Text -> [ Text ] normalOutputLines (OutputMatchFail (CallStack stack)) msg = concat - [ msg <> " on " <> textSourceLine stackTopLine : showVars stackTopLine stackTopVars + [ msg <> " on " <> textSourceLine stackTopLine : showVars stackTopVars , concat $ flip map stackRest $ \( sline, vars ) -> - " called from " <> textSourceLine sline : showVars sline vars + " called from " <> textSourceLine sline : showVars vars ] where - showVars sline = + showVars = map $ \(( name, sel ), value ) -> T.concat [ " ", textFqVarName name, T.concat (map ("."<>) sel) - , " = ", textSomeVarValue sline value + , " = ", textSomeVarValue value ] (( stackTopLine, stackTopVars ), stackRest ) = case stack of @@ -188,13 +188,13 @@ testOutputLines :: OutputType -> Text -> Text -> [ Text ] testOutputLines otype@(OutputMatchFail (CallStack stack)) _ msg = concat [ [ T.concat [ outTestLabel otype, " ", msg ] ] , concat $ flip map stack $ \( sline, vars ) -> - T.concat [ outTestLabel otype, "-line ", textSourceLine sline ] : showVars sline vars + T.concat [ outTestLabel otype, "-line ", textSourceLine sline ] : showVars vars ] where - showVars sline = + showVars = map $ \(( name, sel ), value ) -> T.concat [ outTestLabel otype, "-var ", textFqVarName name, T.concat (map ("."<>) sel) - , " ", textSomeVarValue sline value + , " ", textSomeVarValue value ] testOutputLines otype prompt msg = [ T.concat [ outTestLabel otype, " ", prompt, " ", msg ] ] -- cgit v1.2.3