clean up printing of contexts
- just π.x : A instead of π.(x : A) - skip the " |" if the dctx is empty
This commit is contained in:
parent
78e48911d0
commit
7e3a8e72bd
1 changed files with 16 additions and 5 deletions
|
@ -199,6 +199,13 @@ namespace EqContext
|
|||
injectE (MkEqContext {termLen = Val n, _}) el = el // shift0 n
|
||||
|
||||
|
||||
private
|
||||
data CtxBinder a = MkCtxBinder BaseName a
|
||||
|
||||
PrettyHL a => PrettyHL (CtxBinder a) where
|
||||
prettyM (MkCtxBinder x t) = pure $
|
||||
sep [hsep [!(pretty0M $ TV x), colonD], !(pretty0M t)]
|
||||
|
||||
parameters {auto _ : (Eq q, PrettyHL q, IsQty q)} (unicode : Bool)
|
||||
private
|
||||
pipeD : Doc HL
|
||||
|
@ -210,17 +217,21 @@ parameters {auto _ : (Eq q, PrettyHL q, IsQty q)} (unicode : Bool)
|
|||
go : QContext q m -> NContext m -> TContext q d m -> SnocList (Doc HL)
|
||||
go [<] [<] [<] = [<]
|
||||
go (qs :< q) (xs :< x) (ctx :< t) =
|
||||
let bind = MkWithQty q $ MkBinder x t in
|
||||
let bind = MkWithQty q $ MkCtxBinder x t in
|
||||
go qs xs ctx :< runPretty unicode (pretty0M bind)
|
||||
|
||||
export covering
|
||||
prettyTyContext : TyContext q d n -> Doc HL
|
||||
prettyTyContext (MkTyContext dctx dnames tctx tnames qtys) =
|
||||
sep [prettyDimEq dnames dctx <++> pipeD,
|
||||
case dctx of
|
||||
C [<] => prettyTContext qtys tnames tctx
|
||||
_ => sep [prettyDimEq dnames dctx <++> pipeD,
|
||||
prettyTContext qtys tnames tctx]
|
||||
|
||||
export covering
|
||||
prettyEqContext : EqContext q n -> Doc HL
|
||||
prettyEqContext (MkEqContext dassign dnames tctx tnames qtys) =
|
||||
sep [prettyDimEq dnames (fromGround dassign) <++> pipeD,
|
||||
case dassign of
|
||||
[<] => prettyTContext qtys tnames tctx
|
||||
_ => sep [prettyDimEq dnames (fromGround dassign) <++> pipeD,
|
||||
prettyTContext qtys tnames tctx]
|
||||
|
|
Loading…
Reference in a new issue