@@ -3,6 +3,8 @@ module Language.Reflection.Utils
33import Language.Reflection
44import Language.Reflection.Errors
55
6+%default total
7+
68--------------------------------------------------------
79-- Tactic construction conveniences
810--------------------------------------------------------
@@ -83,46 +85,65 @@ instance Show Const where
8385 show (Fl f) = "(Fl " ++ show f ++ ")"
8486 show (Ch c) = "(Ch " ++ show c ++ ")"
8587 show (Str str) = "(Str " ++ show str ++ ")"
86− show IType = "IType"
87− show BIType = "BIType"
88− show FlType = "FlType"
89− show ChType = "ChType"
90− show StrType = "StrType"
9188 show (B8 b) = "(B8 ...)"
9289 show (B16 b) = "(B16 ...)"
9390 show (B32 b) = "(B32 ...)"
9491 show (B64 b) = "(B64 ...)"
95− show B8Type = "B8Type"
96− show B16Type = "B16Type"
97− show B32Type = "B32Type"
98− show B64Type = "B64Type"
99− show PtrType = "PtrType"
100− show VoidType = "VoidType"
101− show Forgot = "Forgot"
92+ show (B8V xs) = "(B8V " ++ show xs ++ ")"
93+ show (B16V xs) = "(B16V " ++ show xs ++")"
94+ show (B32V xs) = "(B32V " ++ show xs ++ ")"
95+ show (B64V xs) = "(B64V " ++ show xs ++ ")"
96+ show (AType x) = "(AType ...)"
97+ show StrType = "StrType"
98+ show PtrType = "PtrType"
99+ show ManagedPtrType = "ManagedPtrType"
100+ show BufferType = "BufferType"
101+ show VoidType = "VoidType"
102+ show Forgot = "Forgot"
103+
104+instance Eq NativeTy where
105+ IT8 == IT8 = True
106+ IT16 == IT16 = True
107+ IT32 == IT32 = True
108+ IT64 == IT64 = True
109+ _ == _ = False
110+
111+instance Eq Reflection.IntTy where
112+ (ITFixed x) == (ITFixed y) = x == y
113+ ITNative == ITNative = True
114+ ITBig == ITBig = True
115+ ITChar == ITChar = True
116+ (ITVec x i) == (ITVec y j) = x == y && i == j
117+ _ == _ = False
118+
119+instance Eq ArithTy where
120+ (ATInt x) == (ATInt y) = x == y
121+ ATFloat == ATFloat = True
122+ _ == _ = False
102123
103124instance Eq Const where
104− (I i) == (I i') = i == i'
105− (BI n) == (BI n') = n == n'
106− (Fl f) == (Fl f') = f == f'
107− (Ch c) == (Ch c') = c == c'
108− (Str str) == (Str str') = str == str'
109− IType == IType = True
110− BIType == BIType = True
111− FlType == FlType = True
112− ChType == ChType = True
113− StrType == StrType = True
114− (B8 b) == (B8 b') = False -- FIXME: b == b'
115− (B16 b) == (B16 b') = False -- FIXME: b == b'
116− (B32 b) == (B32 b') = False -- FIXME: b == b'
117− (B64 b) == (B64 b') = False -- FIXME: b == b'
118− B8Type == B8Type = True
119− B16Type == B16Type = True
120− B32Type == B32Type = True
121− B64Type == B64Type = True
122− PtrType == PtrType = True
123− VoidType == VoidType = True
124− Forgot == Forgot = True
125− x == y = False
125+ (I x) == (I y) = x == y
126+ (BI x) == (BI y) = x == y
127+ (Fl x) == (Fl y) = x == y
128+ (Ch x) == (Ch y) = x == y
129+ (Str x) == (Str y) = x == y
130+ (B8 x) == (B8 y) = x == y
131+ (B16 x) == (B16 y) = x == y
132+ (B32 x) == (B32 y) = x == y
133+ (B64 x) == (B64 y) = x == y
134+ (B8V xs) == (B8V ys) = False -- TODO
135+ (B16V xs) == (B16V ys) = False -- TODO
136+ (B32V xs) == (B32V ys) = False -- TODO
137+ (B64V xs) == (B64V ys) = False -- TODO
138+ (AType x) == (AType y) = x == y
139+ StrType == StrType = True
140+ PtrType == PtrType = True
141+ ManagedPtrType == ManagedPtrType = True
142+ BufferType == BufferType = True
143+ VoidType == VoidType = True
144+ Forgot == Forgot = True
145+ _ == _ = False
146+
126147
127148instance Show NameType where
128149 show Bound = "Bound"