- true_bottom = (True, panic "getTypeString")
-
- --------------------------------------------------
- -- tidy: very ad-hoc
- tidy [] = [] -- done
-
- tidy (' ' : more)
- = case more of
- ' ' : _ -> tidy more
- '-' : '>' : xs -> '-' : '>' : tidy (no_leading_sps xs)
- other -> ' ' : tidy more
-
- tidy (',' : more) = ',' : tidy (no_leading_sps more)
-
- tidy (x : xs) = x : tidy xs -- catch all
-
- no_leading_sps [] = []
- no_leading_sps (' ':xs) = no_leading_sps xs
- no_leading_sps other = other
-
-typeMaybeString :: Maybe Type -> [FAST_STRING]
-typeMaybeString Nothing = [SLIT("!")]
-typeMaybeString (Just t) = getTypeString t
-
-specMaybeTysSuffix :: [Maybe Type] -> FAST_STRING
-specMaybeTysSuffix ty_maybes
- = let
- ty_strs = concat (map typeMaybeString ty_maybes)
- dotted_tys = [ _CONS_ '.' str | str <- ty_strs ]
- in
- _CONCAT_ dotted_tys
-\end{code}
-
-========================================================
- INTERFACE STUFF; move it out
-
-
-\begin{pseudocode}
-pprTyCon sty@PprInterface (SynonymTyCon k n a vs exp unabstract) specs
- = ASSERT (null specs)
- let
- lookup_fn = mk_lookup_tyvar_fn sty vs
- pp_tyvars = map lookup_fn vs
- in
- ppCat [ppPStr SLIT("type"), ppr sty n, ppIntersperse ppSP pp_tyvars,
- ppEquals, ppr_ty sty lookup_fn tOP_PREC exp]
-
-pprTyCon sty@PprInterface this_tycon@(DataTyCon u n k vs ctxt cons derivings data_or_new) specs
- = ppHang (ppCat [pp_data_or_new,
- pprContext sty ctxt,
- ppr sty n,
- ppIntersperse ppSP (map lookup_fn vs)])
- 4
- (ppCat [pp_unabstract_condecls,
- pp_pragma])
- -- NB: we do not print deriving info in interfaces
- where
- lookup_fn = mk_lookup_tyvar_fn sty vs
-
- pp_data_or_new = case data_or_new of
- DataType -> ppPStr SLIT("data")
- NewType -> ppPStr SLIT("newtype")
-
- yes_we_print_condecls
- = unabstract
- && not (null cons) -- we know what they are
- && (case (getExportFlag n) of
- ExportAbs -> False
- other -> True)
-
- yes_we_print_pragma_condecls
- = not yes_we_print_condecls
- && not opt_OmitInterfacePragmas
- && not (null cons)
- && not (maybeToBool (maybePurelyLocalTyCon this_tycon))
- {- && not (any (dataConMentionsNonPreludeTyCon this_tycon) cons) -}
-
- yes_we_print_pragma_specs
- = not (null specs)