1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

Define builtin behaviours in runPrimitive.

This commit is contained in:
Rob Rix 2018-05-28 10:58:27 -04:00
parent 54988fa3df
commit 22e01c9ed3

View File

@ -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)