| ... |
... |
@@ -81,19 +81,30 @@ data HsLit x |
|
81
|
81
|
| XLit !(XXLit x)
|
|
82
|
82
|
|
|
83
|
83
|
instance (Eq (XXLit x)) => Eq (HsLit x) where
|
|
84
|
|
- (HsChar _ x1) == (HsChar _ x2) = x1==x2
|
|
85
|
|
- (HsCharPrim _ x1) == (HsCharPrim _ x2) = x1==x2
|
|
86
|
|
- (HsString _ x1) == (HsString _ x2) = x1==x2
|
|
87
|
|
- (HsStringPrim _ x1) == (HsStringPrim _ x2) = x1==x2
|
|
88
|
|
- (HsInt _ x1) == (HsInt _ x2) = x1==x2
|
|
89
|
|
- (HsIntPrim _ x1) == (HsIntPrim _ x2) = x1==x2
|
|
90
|
|
- (HsWordPrim _ x1) == (HsWordPrim _ x2) = x1==x2
|
|
91
|
|
- (HsInt64Prim _ x1) == (HsInt64Prim _ x2) = x1==x2
|
|
92
|
|
- (HsWord64Prim _ x1) == (HsWord64Prim _ x2) = x1==x2
|
|
93
|
|
- (HsFloatPrim _ x1) == (HsFloatPrim _ x2) = x1==x2
|
|
94
|
|
- (HsDoublePrim _ x1) == (HsDoublePrim _ x2) = x1==x2
|
|
95
|
|
- (XLit x1) == (XLit x2) = x1==x2
|
|
96
|
|
- _ == _ = False
|
|
|
84
|
+ HsChar _ x1 == HsChar _ x2 = x1 == x2
|
|
|
85
|
+ HsChar{} == _ = False
|
|
|
86
|
+ HsCharPrim _ x1 == HsCharPrim _ x2 = x1 == x2
|
|
|
87
|
+ HsCharPrim{} == _ = False
|
|
|
88
|
+ HsString _ x1 == HsString _ x2 = x1 == x2
|
|
|
89
|
+ HsString{} == _ = False
|
|
|
90
|
+ HsStringPrim _ x1 == HsStringPrim _ x2 = x1 == x2
|
|
|
91
|
+ HsStringPrim{} == _ = False
|
|
|
92
|
+ HsInt _ x1 == HsInt _ x2 = x1 == x2
|
|
|
93
|
+ HsInt{} == _ = False
|
|
|
94
|
+ HsIntPrim _ x1 == HsIntPrim _ x2 = x1 == x2
|
|
|
95
|
+ HsIntPrim{} == _ = False
|
|
|
96
|
+ HsWordPrim _ x1 == HsWordPrim _ x2 = x1 == x2
|
|
|
97
|
+ HsWordPrim{} == _ = False
|
|
|
98
|
+ HsInt64Prim _ x1 == HsInt64Prim _ x2 = x1 == x2
|
|
|
99
|
+ HsInt64Prim{} == _ = False
|
|
|
100
|
+ HsWord64Prim _ x1 == HsWord64Prim _ x2 = x1 == x2
|
|
|
101
|
+ HsWord64Prim{} == _ = False
|
|
|
102
|
+ HsFloatPrim _ x1 == HsFloatPrim _ x2 = x1 == x2
|
|
|
103
|
+ HsFloatPrim{} == _ = False
|
|
|
104
|
+ HsDoublePrim _ x1 == HsDoublePrim _ x2 = x1 == x2
|
|
|
105
|
+ HsDoublePrim{} == _ = False
|
|
|
106
|
+ XLit x1 == XLit x2 = x1 == x2
|
|
|
107
|
+ XLit{} == _ = False
|
|
97
|
108
|
|
|
98
|
109
|
-- | Haskell Overloaded Literal
|
|
99
|
110
|
data HsOverLit p
|
| ... |
... |
@@ -114,18 +125,23 @@ data OverLitVal |
|
114
|
125
|
deriving Data
|
|
115
|
126
|
|
|
116
|
127
|
instance Eq OverLitVal where
|
|
117
|
|
- (HsIntegral i1) == (HsIntegral i2) = i1 == i2
|
|
118
|
|
- (HsFractional f1) == (HsFractional f2) = f1 == f2
|
|
119
|
|
- (HsIsString _ s1) == (HsIsString _ s2) = s1 == s2
|
|
120
|
|
- _ == _ = False
|
|
|
128
|
+ HsIntegral i1 == HsIntegral i2 = i1 == i2
|
|
|
129
|
+ HsIntegral{} == _ = False
|
|
|
130
|
+ HsFractional f1 == HsFractional f2 = f1 == f2
|
|
|
131
|
+ HsFractional{} == _ = False
|
|
|
132
|
+ HsIsString _ s1 == HsIsString _ s2 = s1 == s2
|
|
|
133
|
+ HsIsString{} == _ = False
|
|
121
|
134
|
|
|
122
|
135
|
instance Ord OverLitVal where
|
|
123
|
|
- compare (HsIntegral i1) (HsIntegral i2) = i1 `compare` i2
|
|
124
|
|
- compare (HsIntegral _) (HsFractional _) = LT
|
|
125
|
|
- compare (HsIntegral _) (HsIsString _ _) = LT
|
|
126
|
|
- compare (HsFractional f1) (HsFractional f2) = f1 `compare` f2
|
|
127
|
|
- compare (HsFractional _) (HsIntegral _) = GT
|
|
128
|
|
- compare (HsFractional _) (HsIsString _ _) = LT
|
|
129
|
|
- compare (HsIsString _ s1) (HsIsString _ s2) = s1 `lexicalCompareFS` s2
|
|
130
|
|
- compare (HsIsString _ _) (HsIntegral _) = GT
|
|
131
|
|
- compare (HsIsString _ _) (HsFractional _) = GT |
|
|
136
|
+ -- HsIntegral
|
|
|
137
|
+ HsIntegral i1 `compare` HsIntegral i2 = i1 `compare` i2
|
|
|
138
|
+ HsIntegral{} `compare` HsFractional{} = LT
|
|
|
139
|
+ HsIntegral{} `compare` HsIsString{} = LT
|
|
|
140
|
+ -- HsFractional
|
|
|
141
|
+ HsFractional{} `compare` HsIntegral{} = GT
|
|
|
142
|
+ HsFractional f1 `compare` HsFractional f2 = f1 `compare` f2
|
|
|
143
|
+ HsFractional{} `compare` HsIsString{} = LT
|
|
|
144
|
+ -- HsIsString
|
|
|
145
|
+ HsIsString{} `compare` HsIntegral{} = GT
|
|
|
146
|
+ HsIsString{} `compare` HsFractional{} = GT
|
|
|
147
|
+ HsIsString _ s1 `compare` HsIsString _ s2 = s1 `lexicalCompareFS` s2 |