funcons-tools-0.1.0.0: cbs/Funcons/Core/Abstractions/Functions/PartialApply.hs
-- GeNeRaTeD fOr: ../../CBS/Funcons/Abstractions/Functions/partial-apply.aterm
{-# LANGUAGE OverloadedStrings #-}
module Funcons.Core.Abstractions.Functions.PartialApply where
import Funcons.EDSL
entities = []
types = typeEnvFromList
[]
funcons = libFromList
[("partial-apply",StrictFuncon stepPartial_apply)]
-- |
-- /partial-apply(F,V)/ provides /V/ as the first argument to a function
-- expecting a pair of arguments, returning a function expecting only the
-- second argument.
partial_apply_ fargs = FApp "partial-apply" (FTuple fargs)
stepPartial_apply fargs =
evalRules [rewrite1] []
where rewrite1 = do
let env = emptyEnv
env <- vsMatch fargs [VPAnnotated (VPMetaVar "F") (TName "values"),VPAnnotated (VPMetaVar "V") (TName "values")] env
rewriteTermTo (TApp "thunk" (TTuple [TApp "apply" (TTuple [TVar "F",TTuple [TVar "V",TName "given"]])])) env