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

Define a handler for Primitive effects.

This commit is contained in:
Rob Rix 2018-05-28 10:43:00 -04:00
parent fc5600e23c
commit aea17bb2ec

View File

@ -1,4 +1,4 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DataKinds, GADTs, TypeOperators #-}
module Control.Abstract.Primitive where
import Control.Abstract.Addressable
@ -74,3 +74,6 @@ defineBuiltins =
data Primitive value result where
Prim :: Builtin -> Primitive value value
runPrimitive :: (Builtin -> Evaluator location value effects value) -> Evaluator location value (Primitive value ': effects) a -> Evaluator location value effects a
runPrimitive handler = interpret (\ (Prim builtin) -> handler builtin)