on master help sign in
Add Eq to parts of canonical AST
4992c30Evan Czaplicki
compiler/src/AST/Canonical.hs+12−4
@@ -180,6 +180,7 @@ data PatternCtorArg =
180
180
181
181
182data Annotation = Forall FreeVars Type
182data Annotation = Forall FreeVars Type
183+ deriving (Eq)
183
184
184
185
185type FreeVars = Map.Map Name ()
186type FreeVars = Map.Map Name ()
@@ -193,15 +194,17 @@ data Type
193 | TUnit
194 | TUnit
194 | TTuple Type Type (Maybe Type)
195 | TTuple Type Type (Maybe Type)
195 | TAlias ModuleName.Canonical Name [(Name, Type)] AliasType
196 | TAlias ModuleName.Canonical Name [(Name, Type)] AliasType
197+ deriving (Eq)
196
198
197
199
198data AliasType
200data AliasType
199 = Holey Type
201 = Holey Type
200 | Filled Type
202 | Filled Type
203+ deriving (Eq)
201
204
202
205
203−data FieldType =
204− FieldType {-# UNPACK #-} !Word16 Type
206+data FieldType = FieldType {-# UNPACK #-} !Word16 Type
207+ deriving (Eq)
205
208
206
209
207-- NOTE: The Word16 marks the source order, but it may not be available
210-- NOTE: The Word16 marks the source order, but it may not be available
@@ -237,7 +240,11 @@ data Module =
237
240
238
241
239data Alias = Alias [Name] Type
242data Alias = Alias [Name] Type
243+ deriving (Eq)
244+
245+
240data Binop = Binop_ Binop.Associativity Binop.Precedence Name
246data Binop = Binop_ Binop.Associativity Binop.Precedence Name
247+ deriving (Eq)
241
248
242
249
243data Union =
250data Union =
@@ -247,6 +254,7 @@ data Union =
247 , _u_numAlts :: Int -- CACHE numAlts for exhaustiveness checking
254 , _u_numAlts :: Int -- CACHE numAlts for exhaustiveness checking
248 , _u_opts :: CtorOpts -- CACHE which optimizations are available
255 , _u_opts :: CtorOpts -- CACHE which optimizations are available
249 }
256 }
257+ deriving (Eq)
250
258
251
259
252data CtorOpts
260data CtorOpts
@@ -256,8 +264,8 @@ data CtorOpts
256 deriving (Eq, Ord)
264 deriving (Eq, Ord)
257
265
258
266
259−data Ctor =
260− Ctor Name Index.ZeroBased Int [Type] -- CACHE length args
267+data Ctor = Ctor Name Index.ZeroBased Int [Type] -- CACHE length args
268+ deriving (Eq)
261
269
262
270
263
271