PrintAs.hs revision 5581c4644d91dcb9b7e2e7f6052f7cbf5f97b6de
eb483f2216949400bfef8f6deb5320f071445626Christian MaederModule : $Header$
eb483f2216949400bfef8f6deb5320f071445626Christian MaederCopyright : (c) Christian Maeder and Uni Bremen 2003
eb483f2216949400bfef8f6deb5320f071445626Christian MaederLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
eb483f2216949400bfef8f6deb5320f071445626Christian MaederMaintainer : maeder@tzi.de
eb483f2216949400bfef8f6deb5320f071445626Christian MaederStability : experimental
eb483f2216949400bfef8f6deb5320f071445626Christian MaederPortability : portable
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederprinting data types of the abstract syntax
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- | short cut for: if b then empty else d
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedernoPrint :: Bool -> Doc -> Doc
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedernoPrint b d = if b then empty else d
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedernoNullPrint :: [a] -> Doc -> Doc
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedernoNullPrint = noPrint . null
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedersemiDs :: Pretty a => [a] -> Doc
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedersemiDs = fsep . punctuate semi . map pretty
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedersemiAnnoted :: Pretty a => [Annoted a] -> Doc
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedersemiAnnoted = semiAnnos pretty
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederinstance Pretty Variance where
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder pretty = sidDoc . mkSimpleId . show
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederinstance Pretty a => Pretty (AnyKind a) where
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder pretty knd = case knd of
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder ClassKind ci -> pretty ci
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder FunKind v k1 k2 _ -> fsep [pretty v <>
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder FunKind _ _ _ _ -> parens
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder _ -> id) (pretty k1)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederinstance Pretty TypePattern where
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder pretty tp = case tp of
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder TypePattern name args _ -> pretty name
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder <> fcat (map (parens . pretty) args)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder TypePatternToken t -> pretty t
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder MixfixTypePattern ts -> fsep (map (pretty) ts)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder BracketTypePattern k l _ -> bracket k $ ppWithCommas l
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder TypePatternArg t _ -> parens $ pretty t
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- | put proper brackets around a document
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederbracket :: BracketKind -> Doc -> Doc
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederbracket b = case b of
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder Parens -> parens
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder Squares -> brackets
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder Braces -> specBraces
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder NoBrackets -> id
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- | print a 'Kind' plus a preceding colon (or nothing)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederprintKind :: Kind -> Doc
2eb84fc82d3ffa9116bc471fda3742bd9e5a24bbChristian MaederprintKind k = noPrint (k == universe) $ printVarKind InVar (VarKind k)
2eb84fc82d3ffa9116bc471fda3742bd9e5a24bbChristian Maeder-- | print the kind of a variable with its variance and a preceding colon
2eb84fc82d3ffa9116bc471fda3742bd9e5a24bbChristian MaederprintVarKind :: Variance -> VarKind -> Doc
2eb84fc82d3ffa9116bc471fda3742bd9e5a24bbChristian MaederprintVarKind e vk = case vk of
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder space <> less <+> pretty t
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder VarKind k -> space <> colon <+>
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder pretty e <> pretty k
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder MissingKind -> empty
eb483f2216949400bfef8f6deb5320f071445626Christian Maederdata TypePrec = Outfix | Prefix | ProdInfix | FunInfix deriving (Eq, Ord)
7325bbe03797fd413af504fb3fac109b2c652a7bChristian MaederparenPrec :: TypePrec -> (TypePrec, Doc) -> Doc
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederparenPrec p1 (p2, d) = if p2 < p1 then d else parens d
eb483f2216949400bfef8f6deb5320f071445626Christian MaedertoMixType :: Type -> (TypePrec, Doc)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedertoMixType typ = case typ of
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder ExpandedType t1 _ -> toMixType t1
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder {- (Prefix, ExpandedType
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder (parenPrec Prefix $ toMixType t1)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder $ parenPrec Prefix $ toMixType t2) -}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder BracketType k l _ -> (Outfix, bracket k $ sepByCommas $ map
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski (snd . toMixType) l)
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski KindedType t kind _ -> (Prefix,
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski fsep [parenPrec Prefix $ toMixType t, colon, pretty kind])
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski MixfixType ts -> (Prefix, fsep $ map (snd . toMixType) ts)
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski _ -> let (topTy, tyArgs) = getTypeAppl typ in
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski case topTy of
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski TypeName name@(Id ts cs _) _k _i -> let topDoc = pretty name in
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski case tyArgs of
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski [] -> (Outfix, pretty name)
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski [arg] -> let dArg = toMixType arg in
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski [e1, e2, e3] | not (isPlace e1) && isPlace e2
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski && not (isPlace e3) && null cs ->
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski (Outfix, fsep [pretty e1, snd dArg, pretty e3])
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski _ -> (Prefix, fsep [topDoc, parenPrec Prefix dArg])
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski [arg1, arg2] -> let dArg1 = toMixType arg1
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder dArg2 = toMixType arg2 in
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder [e1, e2, e3] | isPlace e1 && not (isPlace e2)
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski && isPlace e3 && null cs ->
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder if tokStr e2 == prodS then
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder (ProdInfix, fsep [
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder parenPrec ProdInfix dArg1, cross,
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder parenPrec ProdInfix dArg2])
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder else -- assume fun type
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder (FunInfix, fsep [
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder parenPrec FunInfix dArg1, pretty e2, snd dArg2])
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder _ -> (Prefix, fsep [topDoc, parenPrec Prefix dArg1,
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder parenPrec Prefix dArg2])
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder _ -> if name == productId (length tyArgs) then
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder (ProdInfix, fsep $ punctuate (space <> cross) $
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder map (parenPrec ProdInfix . toMixType) tyArgs)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder else (Prefix, fsep $ topDoc :
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder map (parenPrec Prefix . toMixType) tyArgs)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder _ | null tyArgs -> (Outfix, printType topTy)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder _ -> (Prefix, fsep $ parenPrec ProdInfix (toMixType topTy)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder : map (parenPrec Prefix . toMixType) tyArgs)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederprintType :: Type -> Doc
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederprintType ty = case ty of
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder TypeName name _ _ -> pretty name
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder TypeAppl t1 t2 -> fcat [parens (printType t1),
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder parens (printType t2)]
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder ExpandedType t1 t2 -> fcat [printType t1, text asP, printType t2]
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder TypeToken t -> pretty t
1509ea46b471bef1c5e70864fb1cfc0a5280266bChristian Maeder BracketType k l _ -> bracket k $ sepByCommas $ map (printType) l
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder KindedType t kind _ -> sep [printType t, colon <+> pretty kind]
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder MixfixType ts -> fsep $ map printType ts
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederinstance Pretty Type where
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder pretty = snd . toMixType
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- no curried notation for bound variables
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederinstance Pretty TypeScheme where
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder pretty (TypeScheme vs t _) = let tdoc = pretty t in
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder if null vs then tdoc else
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder fsep [forallDoc, semiDs vs, bullet, tdoc]
afbd86903151121381e4e9d22862136817d7f0f0Christian Maederinstance Pretty Partiality where
afbd86903151121381e4e9d22862136817d7f0f0Christian Maeder pretty p = case p of
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder Partial -> quMarkD
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder Total -> empty
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederinstance Pretty Quantifier where
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder pretty q = case q of
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder Universal -> forallDoc
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder Existential -> exists
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder Unique -> unique
eb483f2216949400bfef8f6deb5320f071445626Christian Maederinstance Pretty TypeQual where
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder pretty q = case q of
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder OfType -> colon
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder AsType -> text asS
afbd86903151121381e4e9d22862136817d7f0f0Christian Maeder InType -> inDoc
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder Inferred -> colon
eb483f2216949400bfef8f6deb5320f071445626Christian Maederinstance Pretty Term where
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder pretty = changeGlobalAnnos addBuiltins . printTerm . rmSomeTypes
afbd86903151121381e4e9d22862136817d7f0f0Christian MaederisSimpleTerm :: Term -> Bool
afbd86903151121381e4e9d22862136817d7f0f0Christian MaederisSimpleTerm trm = case trm of
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder QualVar _ -> True
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder QualOp _ _ _ _ -> True
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder ResolvedMixTerm _ _ _ -> True
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder ApplTerm _ _ _ -> True
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder TupleTerm _ _ -> True
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder TermToken _ -> True
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder BracketTerm _ _ _ -> True
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederparenTermDoc :: Term -> Doc -> Doc
eb483f2216949400bfef8f6deb5320f071445626Christian MaederparenTermDoc trm = if isSimpleTerm trm then id else parens
eb483f2216949400bfef8f6deb5320f071445626Christian MaederprintTermRec :: FoldRec Doc (Doc, Doc)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederprintTermRec = FoldRec
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder { foldQualVar = \ _ vd@(VarDecl v ty _ _) ->
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder TypeName t _ _
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder | isSimpleId v && take 2 (show t) == "_v"
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder _ -> parens $ keyword varS <+> pretty vd
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , foldQualOp = \ _ br n t _ ->
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder parens $ fsep [pretty br, pretty n, colon, pretty $
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder if isPred br then unPredTypeScheme t else t]
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder , foldResolvedMixTerm = \ (ResolvedMixTerm _ os _) n ts _ ->
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder if placeCount n == length ts || null ts then
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder idApplDoc n $ zipWith parenTermDoc os ts
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder else idApplDoc applId [idDoc n, parens $ sepByCommas ts]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , foldApplTerm = \ (ApplTerm o1 o2 _) t1 t2 _ ->
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder case (o1, o2) of
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder (ResolvedMixTerm n [] _, TupleTerm ts _)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder | placeCount n == length ts ->
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder idApplDoc n $ zipWith parenTermDoc ts $ map printTerm ts
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder (ResolvedMixTerm n [] _, _) | placeCount n == 1 ->
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder idApplDoc n [parenTermDoc o2 t2]
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder _ -> idApplDoc applId [parenTermDoc o1 t1, parenTermDoc o2 t2]
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder , foldTupleTerm = \ _ ts _ -> parens $ sepByCommas ts
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder , foldTypedTerm = \ (TypedTerm ot _ _ _) t q typ _ -> fsep [(case ot of
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder LambdaTerm {} -> parens
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder LetTerm {} -> parens
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder CaseTerm {} -> parens
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder QuantifiedTerm {} -> parens
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder _ -> id) t, pretty q, pretty typ]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , foldQuantifiedTerm = \ _ q vs t _ ->
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder fsep [pretty q, semiDs vs, bullet, t]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , foldLambdaTerm = \ _ ps q t _ ->
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder fsep [ lambda
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder _ -> fcat $ map parens ps
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder Partial -> bullet
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder Total -> bullet <> text exMark
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , foldCaseTerm = \ _ t es _ ->
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder fsep [text caseS, t, text ofS,
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder cat $ punctuate (space <> bar <> space) $
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder map (printEq0 funArrow) es]
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder , foldLetTerm = \ _ br es t _ ->
7325bbe03797fd413af504fb3fac109b2c652a7bChristian Maeder let des = sep $ punctuate semi $ map (printEq0 equals) es
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder in case br of
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder Let -> fsep [sep [text letS <+> des, text inS], t]
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder Where -> fsep [sep [t, text whereS], des]
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder Program -> text programS <+> des
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder , foldTermToken = \ _ t -> pretty t
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder , foldMixTypeTerm = \ _ q t _ -> pretty q <+> pretty t
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder , foldMixfixTerm = \ _ ts -> fsep ts
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , foldBracketTerm = \ _ k l _ -> bracket k $ sepByCommas l
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder , foldAsPattern = \ _ (VarDecl v _ _ _) p _ ->
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder fsep [pretty v, text asP, p]
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder , foldProgEq = \ _ p t _ -> (p, t)
50dce6b011347f92377adb8bbabaeeb80975e86dChristian MaederprintTerm :: Term -> Doc
50dce6b011347f92377adb8bbabaeeb80975e86dChristian MaederprintTerm = foldTerm printTermRec
50dce6b011347f92377adb8bbabaeeb80975e86dChristian MaederrmTypeRec :: MapRec
90bf4bf40789422552e566b73738ba5efae144c3Christian MaederrmTypeRec = mapRec
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder { -- foldQualVar = \ _ (VarDecl v _ _ ps) -> ResolvedMixTerm v [] ps
e3c9174a782e90f965a0b080c22861c3ef5af12dTill Mossakowski foldQualOp = \ t _ (InstOpId i _ _) _ ps ->
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder if elem i $ map fst bList then
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder ResolvedMixTerm i [] ps else t
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder , foldTypedTerm = \ _ nt q ty ps ->
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder Inferred -> nt
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder _ -> case nt of
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder TypedTerm _ oq oty _ | oty == ty || oq == InType -> nt
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder QualVar (VarDecl _ oty _ _) | oty == ty -> nt
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder _ -> TypedTerm nt q ty ps
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederrmSomeTypes :: Term -> Term
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederrmSomeTypes = foldTerm rmTypeRec
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- | print an equation with different symbols between 'Pattern' and 'Term'
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederprintEq0 :: Doc -> (Doc, Doc) -> Doc