-- GeNeRaTeD fOr: ../../CBS/Funcons/Computations/Data flow/Storing/Simple variables/allocate-initialised-variable.aterm {-# LANGUAGE OverloadedStrings #-} module Funcons.Core.Computations.DataFlow.Storing.SimpleVariables.AllocateInitialisedVariable where import Funcons.EDSL entities = [] types = typeEnvFromList [] funcons = libFromList [("allocate-initialised-variable",StrictFuncon stepAllocate_initialised_variable)] -- | -- /allocate-initialised-variable(T,V)/ computes a simple variable for storing -- values of type /T/ , and initialises its value to /V/ . -- This /fail/ s if the type of /V/ is not a subtype of /T/ . allocate_initialised_variable_ fargs = FApp "allocate-initialised-variable" (FTuple fargs) stepAllocate_initialised_variable fargs = evalRules [rewrite1] [] where rewrite1 = do let env = emptyEnv env <- vsMatch fargs [VPAnnotated (VPMetaVar "T") (TName "values"),VPAnnotated (VPMetaVar "V") (TName "values")] env rewriteTermTo (TApp "give" (TTuple [TApp "allocate-variable" (TTuple [TVar "T"]),TApp "sequential" (TTuple [TApp "assign" (TTuple [TName "given",TVar "V"]),TName "given"])])) env