-- GeNeRaTeD fOr: ../../CBS/Funcons/Computations/Control flow/Normal/Iterating/Definite/Mapping collections/map-map.aterm {-# LANGUAGE OverloadedStrings #-} module Funcons.Core.Computations.ControlFlow.Normal.Iterating.Definite.MappingCollections.MapMap where import Funcons.EDSL entities = [] types = typeEnvFromList [] funcons = libFromList [("map-map",PartiallyStrictFuncon [NonStrict,Strict] stepMap_map)] -- | -- /map-map(X,M)/ maps the computation /F/ over the map /M/ , interleaved, -- evaluating /F/ for each given key/entry pair in /M/ , uniting the results. map_map_ fargs = FApp "map-map" (FTuple fargs) stepMap_map fargs@[arg1,arg2] = evalRules [rewrite1] [] where rewrite1 = do let env = emptyEnv env <- fsMatch fargs [PMetaVar "F",PAnnotated (PMetaVar "M") (TName "values")] env rewriteTermTo (TApp "list-to-map" (TTuple [TApp "list-map" (TTuple [TTuple [TName "given1",TVar "F"],TApp "map-to-list" (TTuple [TVar "M"])])])) env stepMap_map fargs = sortErr (FApp "map-map" (FTuple fargs)) "invalid number of arguments"