packages feed

funcons-tools-0.1.0.0: cbs/Funcons/Core/Abstractions/Functions/Lambda.hs

-- GeNeRaTeD fOr: ../../CBS/Funcons/Abstractions/Functions/lambda.aterm
{-# LANGUAGE OverloadedStrings #-}

module Funcons.Core.Abstractions.Functions.Lambda where

import Funcons.EDSL

entities = []

types = typeEnvFromList
    []

funcons = libFromList
    [("lambda",NonStrictFuncon stepLambda)]

-- |
-- /lambda(E)/ computes a statically scoped function (i.e. a closed thunk).
--   When applied to a value /V/ , free occurrences of /given/ in /E/ refer to /V/ .
lambda_ fargs = FApp "lambda" (FTuple fargs)
stepLambda fargs =
    evalRules [rewrite1] []
    where rewrite1 = do
            let env = emptyEnv
            env <- fsMatch fargs [PMetaVar "E"] env
            rewriteTermTo (TApp "close" (TTuple [TApp "thunk" (TTuple [TVar "E"])])) env