packages feed

funcons-tools-0.1.0.0: cbs/Funcons/Core/Computations/DataFlow/Binding/Recursion/BoundRecursively.hs

-- GeNeRaTeD fOr: ../../CBS/Funcons/Computations/Data flow/Binding/Recursion/bound-recursively.aterm
{-# LANGUAGE OverloadedStrings #-}

module Funcons.Core.Computations.DataFlow.Binding.Recursion.BoundRecursively where

import Funcons.EDSL

entities = []

types = typeEnvFromList
    []

funcons = libFromList
    [("bound-recursively",StrictFuncon stepBound_recursively)]

-- |
-- /bound-recursively(B)/ returns the value currently bound to /B/ , unless that
--  value is a /links/ , in which case it returns the value linked to by that link.
--  This is intended to be used in situations when the binder /B/ may be a
--  recursive binding formed using /recursive/ or /bind-recursively/ .
bound_recursively_ fargs = FApp "bound-recursively" (FTuple fargs)
stepBound_recursively fargs =
    evalRules [rewrite1] []
    where rewrite1 = do
            let env = emptyEnv
            env <- vsMatch fargs [VPAnnotated (VPMetaVar "B") (TName "values")] env
            rewriteTermTo (TApp "follow-if-link" (TTuple [TApp "bound" (TTuple [TVar "B"])])) env