@@ -64,23 +64,23 @@ binderTy (PVTy t) = t
66 instance Show SpecialName where
66 instance Show SpecialName where
67− show (WhereN i n1 n2) = "(WhereN " ++ show i ++ " " ++
67+ showPrec d (WhereN i n1 n2) = showCon d "WhereN" $ showArg i ++
68− show n1 ++ " " ++ show n2 ++ ")"
68+ showArg n1 ++ showArg n2
69− show (WithN i n) = "(WithN " ++ show i ++ " " ++ show n ++ ")"
69+ showPrec d (WithN i n) = showCon d "WithN" $ showArg i ++ showArg n
70− show (InstanceN i ss) = "(InstanceN " ++ show i ++ " " ++ show ss ++ ")"
70+ showPrec d (InstanceN i ss) = showCon d "InstanceN" $ showArg i ++ showArg ss
71− show (ParentN n s) = "(ParentN " ++ show n ++ " " ++ show s ++ ")"
71+ showPrec d (ParentN n s) = showCon d "ParentN" $ showArg n ++ showArg s
72− show (MethodN n) = "(MethodN " ++ show n ++ ")"
72+ showPrec d (MethodN n) = showCon d "MethodN" $ showArg n
73− show (CaseN n) = "(CaseN " ++ show n ++ ")"
73+ showPrec d (CaseN n) = showCon d "CaseN" $ showArg n
74− show (ElimN n) = "(ElimN " ++ show n ++ ")"
74+ showPrec d (ElimN n) = showCon d "ElimN" $ showArg n
75− show (InstanceCtorN n) = "(InstanceCtorN " ++ show n ++ ")"
75+ showPrec d (InstanceCtorN n) = showCon d "InstanceCtorN" $ showArg n
76− show (MetaN parent meta) = "(MetaN " ++ show parent ++ " " ++ show meta ++ ")"
76+ showPrec d (MetaN parent meta) = showCon d "MetaN" $ showArg parent ++ showArg meta
78 instance Show TTName where
78 instance Show TTName where
79− show (UN str) = "(UN " ++ show str ++ ")"
79+ showPrec d (UN str) = showCon d "UN" $ showArg str
80− show (NS n ns) = "(NS " ++ show n ++ " " ++ show ns ++ ")"
80+ showPrec d (NS n ns) = showCon d "NS" $ showArg n ++ showArg ns
81− show (MN i str) = "(MN " ++ show i ++ " " ++ show str ++ ")"
81+ showPrec d (MN i str) = showCon d "MN" $ showArg i ++ showArg str
82− show (SN sn) = "(SN " ++ assert_total (show sn) ++ ")"
82+ showPrec d (SN sn) = showCon d "SN" $ assert_total (showArg sn)
83− show NErased = "NErased"
83+ showPrec d NErased = "NErased"
86 instance Eq TTName where
86 instance Eq TTName where
@@ -104,28 +104,44 @@ mutual
104 _ == _ = False
104 _ == _ = False
106instance Show TTUExp where
106instance Show TTUExp where
107− show (UVar i) = "(UVar " ++ show i ++ ")"
107+ showPrec d (UVar i) = showCon d "UVar" $ showArg i
108− show (UVal i) = "(UVal " ++ show i ++ ")"
108+ showPrec d (UVal i) = showCon d "UVal" $ showArg i
110instance Eq TTUExp where
110instance Eq TTUExp where
111 (UVar i) == (UVar j) = i == j
111 (UVar i) == (UVar j) = i == j
112 (UVal i) == (UVal j) = i == j
112 (UVal i) == (UVal j) = i == j
113 x == y = False
113 x == y = False
115+instance Show NativeTy where
121+instance Show IntTy where
122+ showPrec d (ITFixed t) = showCon d "ITFixed" $ showArg t
123+ showPrec d ITNative = "ITNative"
124+ showPrec d ITBig = "ITBig"
125+ showPrec d ITChar = "ITChar"
127+instance Show ArithTy where
128+ showPrec d (ATInt t) = showCon d "ATInt" $ showArg t
129+ showPrec d ATFloat = "ATFloat"
115instance Show Const where
131instance Show Const where
116− show (I i) = "(I " ++ show i ++ ")"
132+ showPrec d (I i) = showCon d "I" $ showArg i
117− show (BI n) = "(BI " ++ show n ++ ")"
133+ showPrec d (BI n) = showCon d "BI" $ showArg n
118− show (Fl f) = "(Fl " ++ show f ++ ")"
134+ showPrec d (Fl f) = showCon d "Fl" $ showArg f
119− show (Ch c) = "(Ch " ++ show c ++ ")"
135+ showPrec d (Ch c) = showCon d "Ch" $ showArg c
120− show (Str str) = "(Str " ++ show str ++ ")"
136+ showPrec d (Str str) = showCon d "Str" $ showArg str
121− show (B8 b) = "(B8 ...)"
137+ showPrec d (B8 b) = showCon d "B8" $ showArg b
122− show (B16 b) = "(B16 ...)"
138+ showPrec d (B16 b) = showCon d "B16" $ showArg b
123− show (B32 b) = "(B32 ...)"
139+ showPrec d (B32 b) = showCon d "B32" $ showArg b
124− show (B64 b) = "(B64 ...)"
140+ showPrec d (B64 b) = showCon d "B64" $ showArg b
125− show (AType x) = "(AType ...)"
141+ showPrec d (AType x) = showCon d "AType" $ showArg x
126− show StrType = "StrType"
142+ showPrec d StrType = "StrType"
127− show VoidType = "VoidType"
143+ showPrec d VoidType = "VoidType"
128− show Forgot = "Forgot"
144+ showPrec d Forgot = "Forgot"
130instance Eq NativeTy where
146instance Eq NativeTy where
131 IT8 == IT8 = True
147 IT8 == IT8 = True
@@ -164,10 +180,10 @@ instance Eq Const where
166instance Show NameType where
182instance Show NameType where
167− show Bound = "Bound"
183+ showPrec d Bound = "Bound"
168− show Ref = "Ref"
184+ showPrec d Ref = "Ref"
169− show (DCon t ar) = "(DCon " ++ show t ++ " " ++ show ar ++ ")"
185+ showPrec d (DCon t ar) = showCon d "DCon" $ showArg t ++ showArg ar
170− show (TCon t ar) = "(TCon " ++ show t ++ " " ++ show ar ++ ")"
186+ showPrec d (TCon t ar) = showCon d "TCon" $ showArg t ++ showArg ar
172instance Eq NameType where
188instance Eq NameType where
173 Bound == Bound = True
189 Bound == Bound = True
@@ -177,15 +193,15 @@ instance Eq NameType where
177 x == y = False
193 x == y = False
179instance (Show a) => Show (Binder a) where
195instance (Show a) => Show (Binder a) where
180− show (Lam t) = "(Lam " ++ show t ++ ")"
196+ showPrec d (Lam t) = showCon d "Lam" $ showArg t
181− show (Pi t _) = "(Pi " ++ show t ++ ")"
197+ showPrec d (Pi t1 t2) = showCon d "Pi" $ showArg t1 ++ showArg t2
182− show (Let t1 t2) = "(Let " ++ show t1 ++ " " ++ show t2 ++ ")"
198+ showPrec d (Let t1 t2) = showCon d "Let" $ showArg t1 ++ showArg t2
183− show (NLet t1 t2) = "(NLet " ++ show t1 ++ " " ++ show t2 ++ ")"
199+ showPrec d (NLet t1 t2) = showCon d "NLet" $ showArg t1 ++ showArg t2
184− show (Hole t) = "(Hole " ++ show t ++ ")"
200+ showPrec d (Hole t) = showCon d "Hole" $ showArg t
185− show (GHole t) = "(GHole " ++ show t ++ ")"
201+ showPrec d (GHole t) = showCon d "GHole" $ showArg t
186− show (Guess t1 t2) = "(Guess " ++ show t1 ++ " " ++ show t2 ++ ")"
202+ showPrec d (Guess t1 t2) = showCon d "Guess" $ showArg t1 ++ showArg t2
187− show (PVar t) = "(PVar " ++ show t ++ ")"
203+ showPrec d (PVar t) = showCon d "PVar" $ showArg t
188− show (PVTy t) = "(PVTy " ++ show t ++ ")"
204+ showPrec d (PVTy t) = showCon d "PVTy" $ showArg t
190instance (Eq a) => Eq (Binder a) where
206instance (Eq a) => Eq (Binder a) where
191 (Lam t) == (Lam t') = t == t'
207 (Lam t) == (Lam t') = t == t'
@@ -200,17 +216,17 @@ instance (Eq a) => Eq (Binder a) where
200 x == y = False
216 x == y = False
202instance Show TT where
218instance Show TT where
203− show = my_show
219+ showPrec = my_show
204− where %assert_total my_show : TT -> String
220+ where %assert_total my_show : Prec -> TT -> String
205− my_show (P nt n t) = "(P " ++ show nt ++ " " ++ show n ++ " " ++ show t ++ ")"
221+ my_show d (P nt n t) = showCon d "P" $ showArg nt ++ showArg n ++ showArg t
206− my_show (V i) = "(V " ++ show i ++ ")"
222+ my_show d (V i) = showCon d "V" $ showArg i
207− my_show (Bind n b t) = "(Bind " ++ show n ++ " " ++ show b ++ " " ++ show t ++ ")"
223+ my_show d (Bind n b t) = showCon d "Bind" $ showArg n ++ showArg b ++ showArg t
208− my_show (App t1 t2) = "(App " ++ show t1 ++ " " ++ show t2 ++ ")"
224+ my_show d (App t1 t2) = showCon d "App" $ showArg t1 ++ showArg t2
209− my_show (TConst c) = "(TConst " ++ show c ++ ")"
225+ my_show d (TConst c) = showCon d "TConst" $ showArg c
210− my_show (Proj tm i) = "(Proj " ++ show tm ++ " " ++ show i ++ ")"
226+ my_show d (Proj tm i) = showCon d "Proj" $ showArg tm ++ showArg i
211− my_show Erased = "Erased"
227+ my_show d Erased = "Erased"
212− my_show Impossible = "Impossible"
228+ my_show d Impossible = "Impossible"
213− my_show (TType u) = "(TType " ++ show u ++ ")"
229+ my_show d (TType u) = showCon d "TType" $ showArg u
215instance Eq TT where
231instance Eq TT where
216 a == b = equalp a b
232 a == b = equalp a b
@@ -251,53 +267,53 @@ forget tm = fe [] tm
251 fe env Impossible = Nothing
267 fe env Impossible = Nothing
253instance Show Raw where
269instance Show Raw where
254− show r = my_show r
270+ showPrec = my_show
255− where %assert_total my_show : Raw -> String
271+ where %assert_total my_show : Prec -> Raw -> String
256− my_show (Var n) = "(Var " ++ show n ++ ")"
272+ my_show d (Var n) = showCon d "Var" $ showArg n
257− my_show (RBind n b tm) = "(RBind " ++ show n ++ " " ++ show b ++ " " ++ my_show tm ++ ")"
273+ my_show d (RBind n b tm) = showCon d "RBind" $ showArg n ++ showArg b ++ " " ++ my_show App tm
258− my_show (RApp tm tm') = "(RApp " ++ my_show tm ++ " " ++ my_show tm' ++ ")"
274+ my_show d (RApp tm tm') = showCon d "RApp" $ " " ++ my_show App tm ++ " " ++ my_show App tm'
259− my_show RType = "RType"
275+ my_show d RType = "RType"
260− my_show (RForce tm) = "(RForce " ++ my_show tm ++ ")"
276+ my_show d (RForce tm) = showCon d "RForce" $ " " ++ my_show App tm
261− my_show (RConstant c) = "(RConstant " ++ show c ++ ")"
277+ my_show d (RConstant c) = showCon d "RConstant" $ showArg c
263instance Show SourceLocation where
279instance Show SourceLocation where
264− show (FileLoc filename line col) = "FileLoc \"" ++ filename ++ "\" " ++ show line ++ " " ++ show col
280+ showPrec d (FileLoc filename line col) = showCon d "FileLoc" $ showArg filename ++ showArg line ++ showArg col
266instance Show Err where
282instance Show Err where
267− show (Msg x) = "Msg \"" ++ x ++ "\""
283+ showPrec d (Msg x) = showCon d "Msg" $ showArg x
268− show (InternalMsg x) = "InternalMsg \"" ++ x ++ "\""
284+ showPrec d (InternalMsg x) = showCon d "InternalMsg" $ showArg x
269− show (CantUnify x tm tm' err xs y) = "CantUnify " ++ show x ++
285+ showPrec d (CantUnify x tm tm' err xs y) = showCon d "CantUnify" $ showArg x ++
270− " ( " ++ show tm ++ ") (" ++ show tm' ++ ") (" ++ show err ++ ") " ++
286+ showArg tm ++ showArg tm' ++ showArg err ++
271− show xs ++ " " ++ show y
287+ showArg xs ++ showArg y
272− show (InfiniteUnify n tm xs) = "InfiniteUnify " ++ show n ++ show tm ++ show xs
288+ showPrec d (InfiniteUnify n tm xs) = showCon d "InfiniteUnify" $ showArg n ++ showArg tm ++ showArg xs
273− show (CantConvert tm tm' xs) = "CantConvert " ++ show tm ++ show tm' ++ show xs
289+ showPrec d (CantConvert tm tm' xs) = showCon d "CantConvert" $ showArg tm ++ showArg tm' ++ showArg xs
274− show (CantSolveGoal tm ctxt) = "CantSolveGoal " ++ show tm ++ " " ++ show ctxt
290+ showPrec d (CantSolveGoal tm ctxt) = showCon d "CantSolveGoal" $ showArg tm ++ showArg ctxt
275− show (UnifyScope n n' tm xs) = "UnifyScope " ++ show n ++ " " ++ show n' ++ " " ++ show tm ++ " " ++ show xs
291+ showPrec d (UnifyScope n n' tm xs) = showCon d "UnifyScope" $ showArg n ++ showArg n' ++ showArg tm ++ showArg xs
276− show (CantInferType x) = "CantInferType " ++ show x
292+ showPrec d (CantInferType x) = showCon d "CantInferType" $ showArg x
277− show (NonFunctionType tm tm') = "NonFunctionType " ++ show tm ++ show tm'
293+ showPrec d (NonFunctionType tm tm') = showCon d "NonFunctionType" $ showArg tm ++ showArg tm'
278− show (NotEquality tm tm') = "NotEquality " ++ show tm ++ " " ++ show tm'
294+ showPrec d (NotEquality tm tm') = showCon d "NotEquality" $ showArg tm ++ showArg tm'
279− show (TooManyArguments n) = "TooManyArguments " ++ show n
295+ showPrec d (TooManyArguments n) = showCon d "TooManyArguments" $ showArg n
280− show (CantIntroduce tm) = "CantIntroduce " ++ show tm
296+ showPrec d (CantIntroduce tm) = showCon d "CantIntroduce" $ showArg tm
281− show (NoSuchVariable n) = "NoSuchVariable " ++ show n
297+ showPrec d (NoSuchVariable n) = showCon d "NoSuchVariable" $ showArg n
282− show (WithFnType tm) = "WithFnType " ++ show tm
298+ showPrec d (WithFnType tm) = showCon d "WithFnType" $ showArg tm
283− show (CantMatch tm) = "CantMatch " ++ show tm
299+ showPrec d (CantMatch tm) = showCon d "CantMatch" $ showArg tm
284− show (NoTypeDecl n) = "NoTypeDecl " ++ show n
300+ showPrec d (NoTypeDecl n) = showCon d "NoTypeDecl" $ showArg n
285− show (NotInjective tm tm' x) = "NotInjective " ++ show tm ++ " " ++ show tm'
301+ showPrec d (NotInjective tm tm' x) = showCon d "NotInjective" $ showArg tm ++ showArg tm'
286− show (CantResolve tm) = "CantResolve " ++ show tm
302+ showPrec d (CantResolve tm) = showCon d "CantResolve" $ showArg tm
287− show (InvalidTCArg n tm) = "InvalidTCName " ++ show n ++ " (" ++ show tm ++ ")"
303+ showPrec d (InvalidTCArg n tm) = showCon d "InvalidTCName" $ showArg n ++ showArg tm
288− show (CantResolveAlts xs) = "CantResolveAlts " ++ show xs
304+ showPrec d (CantResolveAlts xs) = showCon d "CantResolveAlts" $ showArg xs
289− show (IncompleteTerm tm) = "IncompleteTerm " ++ show tm
305+ showPrec d (IncompleteTerm tm) = showCon d "IncompleteTerm" $ showArg tm
290− show (NoEliminator s tm) = "NoEliminator " ++ show s ++ " " ++ show tm
306+ showPrec d (NoEliminator s tm) = showCon d "NoEliminator" $ showArg s ++ showArg tm
291− show UniverseError = "UniverseError"
307+ showPrec d UniverseError = "UniverseError"
292− show ProgramLineComment = "ProgramLineComment"
308+ showPrec d ProgramLineComment = "ProgramLineComment"
293− show (Inaccessible n) = "Inaccessible " ++ show n
309+ showPrec d (Inaccessible n) = showCon d "Inaccessible" $ showArg n
294− show (UnknownImplicit n f) = "UnknownImplicit " ++ show n ++ " " ++ show f
310+ showPrec d (UnknownImplicit n f) = showCon d "UnknownImplicit" $ showArg n ++ showArg f
295− show (NonCollapsiblePostulate n) = "NonCollapsiblePostulate " ++ show n
311+ showPrec d (NonCollapsiblePostulate n) = showCon d "NonCollapsiblePostulate" $ showArg n
296− show (AlreadyDefined n) = "AlreadyDefined " ++ show n
312+ showPrec d (AlreadyDefined n) = showCon d "AlreadyDefined" $ showArg n
297− show (ProofSearchFail err) = "ProofSearchFail " ++ show err
313+ showPrec d (ProofSearchFail err) = showCon d "ProofSearchFail" $ showArg err
298− show (NoRewriting tm) = "NoRewriting " ++ show tm
314+ showPrec d (NoRewriting tm) = showCon d "NoRewriting" $ showArg tm
299− show (ProviderError x) = "ProviderError \"" ++ show x ++ "\""
315+ showPrec d (ProviderError x) = showCon d "ProviderError" $ showArg x
300− show (LoadingFailed x err) = "LoadingFailed " ++ show x ++ " (" ++ show err ++ ")"
316+ showPrec d (LoadingFailed x err) = showCon d "LoadingFailed" $ showArg x ++ showArg err
302-------------------------
318-------------------------
303-- Idiom brackets for Raw
319-- Idiom brackets for Raw