-\begin{code}
- -- Shallowly magical; converts a type into something
- -- vaguely close to what can be used in C identifier.
- -- Produces things like what we have in mkCompoundName,
- -- which can be "dot"ted together...
-
-getTypeString :: Type -> FAST_STRING
-
-getTypeString ty
- = case (splitAppTys ty) of { (tc, args) ->
- _CONCAT_ (do_tc tc : map do_arg_ty args) }
- where
- do_tc (TyConTy tc _) = nameString (getName tc)
- do_tc (SynTy _ _ ty) = do_tc ty
- do_tc other = --pprTrace "getTypeString:do_tc:" (pprType PprDebug other) $
- (_PK_ (show (pprType PprForC other)))
-
- do_arg_ty (TyConTy tc _) = nameString (getName tc)
- do_arg_ty (TyVarTy tv) = _PK_ (show (ppr PprForC tv))
- do_arg_ty (SynTy _ _ ty) = do_arg_ty ty
- do_arg_ty other = --pprTrace "getTypeString:do_arg_ty:" (pprType PprDebug other) $
- _PK_ (show (pprType PprForC other))
-
- -- PprForC expands type synonyms as it goes;
- -- it also forces consistent naming of tycons
- -- (e.g., can't have both "(,) a b" and "(a,b)":
- -- must be consistent!
-
-specMaybeTysSuffix :: [Maybe Type] -> FAST_STRING
-specMaybeTysSuffix ty_maybes
- = panic "PprType.specMaybeTysSuffix"
-{- LATER:
- = let
- ty_strs = concat (map typeMaybeString ty_maybes)
- dotted_tys = [ _CONS_ '.' str | str <- ty_strs ]
- in
- _CONCAT_ dotted_tys
--}
-\end{code}
-