Morphism.hs revision b87efd3db0d2dc41615ea28669faf80fc1b48d56
2796N/Athis file defines morhpisms for the reduce logic. A morphism is a mapping of operator symbols
2796N/Amodule CSL.Morphism
2796N/Aimport qualified Common.Result as Result
2796N/Aimport CSL.AS_BASIC_CSL
2796N/Aimport Common.Result
2796N/Aimport Common.Doc
2796N/Aimport Common.DocUtils
2796N/A <> pretty y <> rparen) $ Map.assocs $ operatorMap m)
, operatorMap = if Map.null gMap then fMap else
Set.fold ( \ i -> let j = applyMap gMap (applyMap fMap i) in
if i == j then id else Map.insert i j)
Map.empty $ items fSource }
, operatorMap = Map.empty }
applyMap :: Map.Map Id Id -> Id -> Id
applyMap operatormap idt = Map.findWithDefault idt idt operatormap
applyMorphism mor idt = Map.findWithDefault idt idt $ operatorMap mor
mapSentence :: Morphism -> CMD -> Result.Result CMD
morphismUnion :: Morphism -> Morphism -> Result.Result Morphism
(pds, pmap) = foldr ( \ (i, j) (ds, m) -> case Map.lookup i m of
Nothing -> (ds, Map.insert i j m)
(Map.toList pmap2 ++ map (\ a -> (a, a))