I need to derive Eq for a data, but for some constructors I want to ignore some fields. The data is for representing DataTypes (we are developing a compiler):
data DataType
= Int | Float | Bool | Char | Range | Type
| String Width
| Record (Lexeme Identifier) (Seq Field) Width
| Union (Lexeme Identifier) (Seq Field) Width
| Array (Lexeme DataType) (Lexeme Expression) Width
| UserDef (Lexeme Identifier)
| Void | TypeError
deriving (Ord)
I need to ignore the Width
field from every contstructor it appears in.