Commit 6545e690 authored by Tim Steenvoorden's avatar Tim Steenvoorden

add pretty printer for values

parent 3c638e5b
Pipeline #25363 failed with stage
in 59 seconds
......@@ -30,7 +30,7 @@ editTaskExpr mv =
enterOrUpdateExpr ("Contruct a task", info1) mv >?>
[ ( "Run", const True, \v -> viewInformation ("Evaluate the task", info2) [] () ||- (evalTaskExpr (toValue taskEditor v) <<@ ApplyLayout frameCompact) >>*
[ OnAction (Action "Back") (always (editTaskExpr (Just v)))
, OnAction (Action "Finish") (ifValue (const True) (\r -> viewInformation ("Done!", info3) [] r >?>
, OnAction (Action "Finish") (ifValue (const True) (\r -> viewInformation ("Done!", info3) [] (toString r) >?>
[ ( "Back", const True, \_ -> editTaskExpr (Just v) ) ]
))
]
......@@ -517,3 +517,12 @@ where
evalFunc (VTuple x1 x2) func = case func of
Fst -> x1
Snd -> x2
instance toString Value where
toString val = case val of
VUnit -> "()"
VInt i -> toString i
VBool b -> toString b
VString s -> toString s
VTuple x y -> "( " +++ toString x +++ ", " +++ toString y +++ ")"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment