MapTerm.hs revision 9d75ab580dbf51b7ca60903fb32e7f38d939d326
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski{- |
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskiModule : $Header$
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskiDescription : renaming according to signature morphisms
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskiCopyright : (c) Christian Maeder and Uni Bremen 2004
e7eefd526faedd63acb8f91de5793368cfe67655Klaus LuettichLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskiMaintainer : Christian.Maeder@dfki.de
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskiStability : provisional
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskiPortability : portable
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
e7eefd526faedd63acb8f91de5793368cfe67655Klaus Luettichrename symbols of terms according to a signature morphisms
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski-}
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowskimodule HasCASL.MapTerm where
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowskiimport HasCASL.As
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowskiimport HasCASL.Le
e7eefd526faedd63acb8f91de5793368cfe67655Klaus Luettichimport HasCASL.FoldTerm
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowskiimport Common.Id
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowskitype Rename = ((Id, TypeScheme) -> (Id, TypeScheme), Type -> Type)
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskirenameRec :: Rename -> MapRec
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskirenameRec m = mapRec
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski { foldQualVar = \ _ vd -> QualVar $ mapVar (snd m) vd
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski , foldQualOp = \ _ b i sc tys qs ->
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski let (i2, sc2) = fst m (i, sc)
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski in QualOp b i2 sc2 (map (snd m) tys) qs
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski , foldTypedTerm = \ _ te q ty ps -> TypedTerm te q (snd m ty) ps
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski , foldQuantifiedTerm = \ _ q vs te ps ->
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski QuantifiedTerm q (map (mapGenVar $ snd m) vs) te ps
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski , foldAsPattern = \ _ vd pa ps -> AsPattern (mapVar (snd m) vd) pa ps
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski , foldMixTypeTerm = \ _ q ty ps -> MixTypeTerm q (snd m ty) ps }
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskimapTerm :: Rename -> Term -> Term
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskimapTerm m = foldTerm $ renameRec m
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskimapEq :: Rename -> ProgEq -> ProgEq
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskimapEq m = foldEq $ renameRec m
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskimapVar :: (Type -> Type) -> VarDecl -> VarDecl
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskimapVar m (VarDecl v ty q ps) = VarDecl v (m ty) q ps
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskimapGenVar :: (Type -> Type) -> GenVarDecl -> GenVarDecl
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskimapGenVar m g = case g of
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski GenVarDecl vd -> GenVarDecl $ mapVar m vd
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski _ -> g
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskimapOpInfo :: Rename -> OpInfo -> OpInfo
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskimapOpInfo m oi = oi
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski { opType = mapTypeOfScheme (snd m) $ opType oi
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski , opAttrs = map (mapOpAttr m) $ opAttrs oi
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski , opDefn = renameOpDefn m $ opDefn oi }
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskimapOpAttr :: Rename -> OpAttr -> OpAttr
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskimapOpAttr m o = case o of
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski UnitOpAttr t p -> UnitOpAttr (mapTerm m t) p
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski _ -> o
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskirenameOpDefn :: Rename -> OpDefn -> OpDefn
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskirenameOpDefn m d = case d of
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski SelectData cs i -> SelectData (map (renameConstrInfo $ snd m) cs) i
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski Definition b t -> Definition b $ mapTerm m t
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski _ -> d
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskirenameConstrInfo :: (Type -> Type) -> ConstrInfo -> ConstrInfo
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till MossakowskirenameConstrInfo m c = c { constrType = mapTypeOfScheme m $ constrType c }
91dd24480df03b2cca7c1645bb2866d7000dfdb1Till Mossakowski