funcons-tools-0.1.0.0: cbs/Funcons/Core/Abstractions/Functions/BindingLambda.hs
-- GeNeRaTeD fOr: ../../CBS/Funcons/Abstractions/Functions/binding-lambda.aterm
{-# LANGUAGE OverloadedStrings #-}
module Funcons.Core.Abstractions.Functions.BindingLambda where
import Funcons.EDSL
entities = []
types = typeEnvFromList
[]
funcons = libFromList
[("binding-lambda",PartiallyStrictFuncon [Strict,NonStrict] stepBinding_lambda)]
-- |
-- /binding-lambda(B,E)/ computes a statically scoped function (i.e. a closed
-- thunk). When applied to a value /V/ , free occurrences of /bound(B)/ in /E/ refer to /V/ .
binding_lambda_ fargs = FApp "binding-lambda" (FTuple fargs)
stepBinding_lambda fargs@[arg1,arg2] =
evalRules [rewrite1] []
where rewrite1 = do
let env = emptyEnv
env <- fsMatch fargs [PAnnotated (PMetaVar "B") (TName "values"),PMetaVar "E"] env
rewriteTermTo (TApp "lambda" (TTuple [TApp "scope" (TTuple [TApp "bind" (TTuple [TVar "B",TName "given"]),TVar "E"])])) env
stepBinding_lambda fargs = sortErr (FApp "binding-lambda" (FTuple fargs)) "invalid number of arguments"