tcInstType :: TcType -> NF_TcM ([TcTyVar], TcThetaType, TcType)
tcInstType ty
= case splitForAllTys ty of
- ([], _) -> returnNF_Tc ([], [], ty) -- Nothing to do
+ ([], rho) -> tcSplitRhoTy rho `thenNF_Tc` \ (theta, tau) ->
+ returnNF_Tc ([], theta, tau)
(tyvars, rho) -> tcInstTyVars tyvars `thenNF_Tc` \ (tyvars', _, tenv) ->
tcSplitRhoTy (substTy tenv rho) `thenNF_Tc` \ (theta, tau) ->
returnNF_Tc (tyvars', theta, tau)
import Type ( PredType(..), ThetaType,
splitPredTy_maybe,
splitForAllTys, splitSigmaTy, splitRhoTy,
- isDictTy, splitTyConApp_maybe, splitFunTy_maybe,
+ isPredTy, isDictTy, splitTyConApp_maybe, splitFunTy_maybe,
predRepTy, isUTyVar
)
import Var ( TyVar, tyVarKind )
-- so we mustn't use splitFunTys here.
= maybeParen ctxt_prec fUN_PREC $
sep [ ppr_ty fUN_PREC ty1
- , ptext SLIT("->") <+> ppr_ty tOP_PREC ty2
+ , ptext arrow <+> ppr_ty tOP_PREC ty2
]
+ where arrow | isPredTy ty1 = SLIT("=>")
+ | otherwise = SLIT("->")
ppr_ty ctxt_prec (AppTy ty1 ty2)
= maybeParen ctxt_prec tYCON_PREC $