packages feed

funcons-tools-0.1.0.0: cbs/Funcons/Core/Abstractions/Patterns/PatternUnite.hs

-- GeNeRaTeD fOr: ../../CBS/Funcons/Abstractions/Patterns/pattern-unite.aterm
{-# LANGUAGE OverloadedStrings #-}

module Funcons.Core.Abstractions.Patterns.PatternUnite where

import Funcons.EDSL

entities = []

types = typeEnvFromList
    []

funcons = libFromList
    [("pattern-unite",StrictFuncon stepPattern_unite)]

-- |
-- /pattern-unite(P1,P2)/ is a pattern that requires the matched value to match
--   both /P1/ and /P2/ , uniting the resulting /environments/ . 
pattern_unite_ fargs = FApp "pattern-unite" (FTuple fargs)
stepPattern_unite fargs =
    evalRules [rewrite1] []
    where rewrite1 = do
            let env = emptyEnv
            env <- vsMatch fargs [VPAnnotated (VPMetaVar "P1") (TName "values"),VPAnnotated (VPMetaVar "P2") (TName "values")] env
            rewriteTermTo (TApp "thunk" (TTuple [TApp "map-unite" (TTuple [TApp "match" (TTuple [TName "given",TVar "P1"]),TApp "match" (TTuple [TName "given",TVar "P2"])])])) env