diff --git a/lib/Quox/Context.idr b/lib/Quox/Context.idr index 69e2a6f..d5b8600 100644 --- a/lib/Quox/Context.idr +++ b/lib/Quox/Context.idr @@ -218,7 +218,7 @@ unzip3 (tel :< (x, y, z)) = -export +public export lengthPrf : Telescope _ from to -> (len ** len + from = to) lengthPrf [<] = (0 ** Refl) lengthPrf (tel :< _) = @@ -234,6 +234,11 @@ public export %inline length : Telescope {} -> Nat length = fst . lengthPrf +public export +null : Telescope _ from to -> Bool +null [<] = True +null _ = False + export foldl : {0 acc : Nat -> Type} -> diff --git a/lib/Quox/Typing/Context.idr b/lib/Quox/Typing/Context.idr index 0db97ad..00afc1b 100644 --- a/lib/Quox/Typing/Context.idr +++ b/lib/Quox/Typing/Context.idr @@ -71,6 +71,10 @@ namespace TyContext empty = 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 extendTyN : Telescope (\n => (q, BaseName, Term q d n)) from to -> TyContext q d from -> TyContext q d to @@ -158,6 +162,10 @@ namespace EqContext dassign = [<], dnames = [<], tctx = [<], tnames = [<], qtys = [<] } + public export %inline + null : EqContext q n -> Bool + null ctx = null ctx.dnames && null ctx.tnames + export %inline extendTyN : Telescope (\n => (q, BaseName, Term q 0 n)) from to -> EqContext q from -> EqContext q to diff --git a/lib/Quox/Typing/Error.idr b/lib/Quox/Typing/Error.idr index a6ae092..04b4c4a 100644 --- a/lib/Quox/Typing/Error.idr +++ b/lib/Quox/Typing/Error.idr @@ -300,12 +300,12 @@ parameters {auto _ : (Eq q, IsQty q, PrettyHL q)} (unicode : Bool) where inTContext : TyContext q d n -> Doc HL -> Doc HL inTContext ctx doc = - if showContext then + if showContext && not (null ctx) then vsep [sep ["in context", prettyTyContext unicode ctx], doc] else doc inEContext : EqContext q n -> Doc HL -> Doc HL inEContext ctx doc = - if showContext then + if showContext && not (null ctx) then vsep [sep ["in context", prettyEqContext unicode ctx], doc] else doc