funcons-tools-0.1.0.0: cbs/Funcons/Core/Computations/DataFlow/Binding/Scope.hs
-- GeNeRaTeD fOr: ../../CBS/Funcons/Computations/Data flow/Binding/scope.aterm
{-# LANGUAGE OverloadedStrings #-}
module Funcons.Core.Computations.DataFlow.Binding.Scope where
import Funcons.EDSL
entities = []
types = typeEnvFromList
[]
funcons = libFromList
[("scope",PartiallyStrictFuncon [Strict,NonStrict] stepScope)]
-- |
-- /scope(Rho,X)/ extends (possibly overriding) the current environment
-- with /Rho/ for the execution of /X/ .
scope_ fargs = FApp "scope" (FTuple fargs)
stepScope fargs@[arg1,arg2] =
evalRules [rewrite1] [step1]
where rewrite1 = do
let env = emptyEnv
env <- fsMatch fargs [PAnnotated (PWildCard) (TName "environments"),PAnnotated (PMetaVar "V") (TName "values")] env
rewriteTermTo (TVar "V") env
step1 = do
let env = emptyEnv
env <- lifted_fsMatch fargs [PAnnotated (PMetaVar "Rho1") (TName "environments"),PMetaVar "X"] env
env <- getInhPatt "environment" (VPMetaVar "Rho0") env
env <- withInhTerm "environment" (TTuple [TApp "map-override" (TTuple [TVar "Rho1",TVar "Rho0"])]) env (premise (TVar "X") (PMetaVar "X'") env)
stepTermTo (TApp "scope" (TTuple [TVar "Rho1",TVar "X'"])) env
stepScope fargs = sortErr (FApp "scope" (FTuple fargs)) "invalid number of arguments"