funcons-tools-0.1.0.0: cbs/Funcons/Core/Abstractions/Functions/Curry.hs
-- GeNeRaTeD fOr: ../../CBS/Funcons/Abstractions/Functions/curry.aterm
{-# LANGUAGE OverloadedStrings #-}
module Funcons.Core.Abstractions.Functions.Curry where
import Funcons.EDSL
entities = []
types = typeEnvFromList
[]
funcons = libFromList
[("curry",StrictFuncon stepCurry)]
-- |
-- /curry(F)/ converts a function that takes a pair of arguments into a function
-- that takes the first argument of the pair, and returns a function that takes
-- the second argument of the pair.
curry_ fargs = FApp "curry" (FTuple fargs)
stepCurry fargs =
evalRules [rewrite1] []
where rewrite1 = do
let env = emptyEnv
env <- vsMatch fargs [VPAnnotated (VPMetaVar "F") (TName "values")] env
rewriteTermTo (TApp "thunk" (TTuple [TApp "partial-apply" (TTuple [TVar "F",TName "given"])])) env