Commit 24eea38c authored by Gergő Érdi's avatar Gergő Érdi
Browse files

pprIfaceDecl for IfacePatSyn: use pprPatSynSig

parent 23c0f1ec
...@@ -55,6 +55,7 @@ import TysWiredIn ( eqTyConName ) ...@@ -55,6 +55,7 @@ import TysWiredIn ( eqTyConName )
import Fingerprint import Fingerprint
import Binary import Binary
import BooleanFormula ( BooleanFormula ) import BooleanFormula ( BooleanFormula )
import HsBinds
import Control.Monad import Control.Monad
import System.IO.Unsafe import System.IO.Unsafe
...@@ -1104,27 +1105,22 @@ pprIfaceDecl (IfaceAxiom {ifName = name, ifTyCon = tycon, ifAxBranches = branche ...@@ -1104,27 +1105,22 @@ pprIfaceDecl (IfaceAxiom {ifName = name, ifTyCon = tycon, ifAxBranches = branche
pprIfaceDecl (IfacePatSyn { ifName = name, ifPatHasWrapper = has_wrap, pprIfaceDecl (IfacePatSyn { ifName = name, ifPatHasWrapper = has_wrap,
ifPatIsInfix = is_infix, ifPatIsInfix = is_infix,
ifPatUnivTvs = univ_tvs, ifPatExTvs = ex_tvs, ifPatUnivTvs = _univ_tvs, ifPatExTvs = _ex_tvs,
ifPatProvCtxt = prov_ctxt, ifPatReqCtxt = req_ctxt, ifPatProvCtxt = prov_ctxt, ifPatReqCtxt = req_ctxt,
ifPatArgs = args, ifPatArgs = args,
ifPatTy = ty }) ifPatTy = ty })
= hang (text "pattern" <+> header) = pprPatSynSig name has_wrap args' ty' (pprCtxt prov_ctxt) (pprCtxt req_ctxt)
4 details
where where
header = ppr name <+> dcolon <+> args' = case (is_infix, map snd args) of
(pprIfaceForAllPart univ_tvs req_ctxt $ (True, [left_ty, right_ty]) ->
pprIfaceForAllPart ex_tvs prov_ctxt $ InfixPatSyn (pprParendIfaceType left_ty) (pprParendIfaceType right_ty)
pp_tau) (_, tys) ->
PrefixPatSyn (map pprParendIfaceType tys)
details = sep [ if is_infix then text "Infix" else empty ty' = pprParendIfaceType ty
, if has_wrap then text "HasWrapper" else empty
]
pp_tau = case map pprParendIfaceType (arg_tys ++ [ty]) of pprCtxt [] = Nothing
(t:ts) -> fsep (t : map (arrow <+>) ts) pprCtxt ctxt = Just $ pprIfaceContext ctxt
[] -> panic "pp_tau"
arg_tys = map snd args
pprCType :: Maybe CType -> SDoc pprCType :: Maybe CType -> SDoc
pprCType Nothing = ptext (sLit "No C type associated") pprCType Nothing = ptext (sLit "No C type associated")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment