From 22e01c9ed383c45b6d04b0ac33114f54f33e7860 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 28 May 2018 10:58:27 -0400 Subject: [PATCH] Define builtin behaviours in runPrimitive. --- src/Control/Abstract/Primitive.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Control/Abstract/Primitive.hs b/src/Control/Abstract/Primitive.hs index 440466c77..5e0cebe70 100644 --- a/src/Control/Abstract/Primitive.hs +++ b/src/Control/Abstract/Primitive.hs @@ -78,5 +78,6 @@ prim builtin params = send (Prim builtin params) data Primitive value result where Prim :: Builtin -> [value] -> Primitive value value -runPrimitive :: (Builtin -> [value] -> Evaluator location value effects value) -> Evaluator location value (Primitive value ': effects) a -> Evaluator location value effects a -runPrimitive handler = interpret (\ (Prim builtin params) -> handler builtin params) +runPrimitive :: (AbstractValue location value effects, Member Trace effects) => Evaluator location value (Primitive value ': effects) a -> Evaluator location value effects a +runPrimitive = interpret (\ (Prim builtin params) -> case builtin of + Print -> traverse (asString >=> trace . unpack) params >> unit)