File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -270,10 +270,21 @@ module Prelude
270270 (==) = refEq
271271 (/=) = refIneq
272272
273+ foreign import eqArrayImpl
274+ " function eqArrayImpl(f) {\
275+ \ return function(xs) {\
276+ \ return function(ys) {\
277+ \ if (xs.length !== ys.length) return false;\
278+ \ for (var i = 0; i < xs.length; i++) {\
279+ \ if (!f(xs[i])(ys[i])) return false;\
280+ \ }\
281+ \ return true;\
282+ \ };\
283+ \ };\
284+ \}" :: forall a . (a -> a -> Boolean ) -> [a ] -> [a ] -> Boolean
285+
273286 instance eqArray :: (Eq a ) => Eq [a ] where
274- (==) [] [] = true
275- (==) (x :xs ) (y :ys ) = x == y && xs == ys
276- (==) _ _ = false
287+ (==) xs ys = eqArrayImpl (==) xs ys
277288 (/=) xs ys = not (xs == ys )
278289
279290 data Ordering = LT | GT | EQ
You can’t perform that action at this time.
0 commit comments