don't print empty contexts in errors
This commit is contained in:
parent
84e1cc78cc
commit
46e13c8ca2
3 changed files with 16 additions and 3 deletions
|
@ -218,7 +218,7 @@ unzip3 (tel :< (x, y, z)) =
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export
|
public export
|
||||||
lengthPrf : Telescope _ from to -> (len ** len + from = to)
|
lengthPrf : Telescope _ from to -> (len ** len + from = to)
|
||||||
lengthPrf [<] = (0 ** Refl)
|
lengthPrf [<] = (0 ** Refl)
|
||||||
lengthPrf (tel :< _) =
|
lengthPrf (tel :< _) =
|
||||||
|
@ -234,6 +234,11 @@ public export %inline
|
||||||
length : Telescope {} -> Nat
|
length : Telescope {} -> Nat
|
||||||
length = fst . lengthPrf
|
length = fst . lengthPrf
|
||||||
|
|
||||||
|
public export
|
||||||
|
null : Telescope _ from to -> Bool
|
||||||
|
null [<] = True
|
||||||
|
null _ = False
|
||||||
|
|
||||||
|
|
||||||
export
|
export
|
||||||
foldl : {0 acc : Nat -> Type} ->
|
foldl : {0 acc : Nat -> Type} ->
|
||||||
|
|
|
@ -71,6 +71,10 @@ namespace TyContext
|
||||||
empty =
|
empty =
|
||||||
MkTyContext {dctx = new, dnames = [<], tctx = [<], tnames = [<], qtys = [<]}
|
MkTyContext {dctx = new, dnames = [<], tctx = [<], tnames = [<], qtys = [<]}
|
||||||
|
|
||||||
|
public export %inline
|
||||||
|
null : TyContext q d n -> Bool
|
||||||
|
null ctx = null ctx.dnames && null ctx.tnames
|
||||||
|
|
||||||
export %inline
|
export %inline
|
||||||
extendTyN : Telescope (\n => (q, BaseName, Term q d n)) from to ->
|
extendTyN : Telescope (\n => (q, BaseName, Term q d n)) from to ->
|
||||||
TyContext q d from -> TyContext q d to
|
TyContext q d from -> TyContext q d to
|
||||||
|
@ -158,6 +162,10 @@ namespace EqContext
|
||||||
dassign = [<], dnames = [<], tctx = [<], tnames = [<], qtys = [<]
|
dassign = [<], dnames = [<], tctx = [<], tnames = [<], qtys = [<]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public export %inline
|
||||||
|
null : EqContext q n -> Bool
|
||||||
|
null ctx = null ctx.dnames && null ctx.tnames
|
||||||
|
|
||||||
export %inline
|
export %inline
|
||||||
extendTyN : Telescope (\n => (q, BaseName, Term q 0 n)) from to ->
|
extendTyN : Telescope (\n => (q, BaseName, Term q 0 n)) from to ->
|
||||||
EqContext q from -> EqContext q to
|
EqContext q from -> EqContext q to
|
||||||
|
|
|
@ -300,12 +300,12 @@ parameters {auto _ : (Eq q, IsQty q, PrettyHL q)} (unicode : Bool)
|
||||||
where
|
where
|
||||||
inTContext : TyContext q d n -> Doc HL -> Doc HL
|
inTContext : TyContext q d n -> Doc HL -> Doc HL
|
||||||
inTContext ctx doc =
|
inTContext ctx doc =
|
||||||
if showContext then
|
if showContext && not (null ctx) then
|
||||||
vsep [sep ["in context", prettyTyContext unicode ctx], doc]
|
vsep [sep ["in context", prettyTyContext unicode ctx], doc]
|
||||||
else doc
|
else doc
|
||||||
|
|
||||||
inEContext : EqContext q n -> Doc HL -> Doc HL
|
inEContext : EqContext q n -> Doc HL -> Doc HL
|
||||||
inEContext ctx doc =
|
inEContext ctx doc =
|
||||||
if showContext then
|
if showContext && not (null ctx) then
|
||||||
vsep [sep ["in context", prettyEqContext unicode ctx], doc]
|
vsep [sep ["in context", prettyEqContext unicode ctx], doc]
|
||||||
else doc
|
else doc
|
||||||
|
|
Loading…
Reference in a new issue