@@ -14,7 +14,7 @@ module Prelude where
1414 (<<<) :: forall b c d. a c d -> a b c -> a b d
1515 (>>>) :: forall b c d. a b c -> a c d -> a b d
1616
17− instance Category (->) where
17+ instance categoryArr :: Category (->) where
1818 id x = x
1919 (<<<) f g x = f (g x)
2020 (>>>) f g x = g (f x)
@@ -31,36 +31,36 @@ module Prelude where
3131 class Show a where
3232 show :: a -> String
3333
34− instance Show String where
34+ instance showString :: Show String where
3535 show s = s
3636
37− instance Show Boolean where
37+ instance showBoolean :: Show Boolean where
3838 show true = "true"
3939 show false = "false"
4040
41− foreign import showNumber "function showNumber(n) {\
42− \ return n.toString();\
43− \}" :: Number -> String
41+ foreign import showNumberImpl "function showNumberImpl(n) {\
42+ \ return n.toString();\
43+ \}" :: Number -> String
4444
45− instance Show Number where
46− show = showNumber
45+ instance showNumber :: Show Number where
46+ show = showNumberImpl
4747
4848 class Read a where
4949 read :: String -> a
5050
51− instance Read String where
51+ instance readString :: Read String where
5252 read s = s
5353
54− instance Read Boolean where
54+ instance readBoolean :: Read Boolean where
5555 read "true" = true
5656 read _ = false
5757
58− foreign import readNumber "function readNumber(n) {\
59− \ return parseFloat(n);\
60− \}" :: String -> Number
58+ foreign import readNumberImpl "function readNumber(n) {\
59+ \ return parseFloat(n);\
60+ \}" :: String -> Number
6161
62− instance Read Number where
63− read = readNumber
62+ instance readNumber :: Read Number where
63+ read = readNumberImpl
6464
6565 infixl 4 <$>
6666
@@ -73,7 +73,7 @@ module Prelude where
7373 pure :: forall a. a -> f a
7474 (<*>) :: forall a b. f (a -> b) -> f a -> f b
7575
76− instance (Applicative f) => Functor f where
76+ instance functorFromApplicative :: (Applicative f) => Functor f where
7777 (<$>) f a = pure f <*> a
7878
7979 infixl 3 <|>
@@ -88,7 +88,7 @@ module Prelude where
8888 return :: forall a. a -> m a
8989 (>>=) :: forall a b. m a -> (a -> m b) -> m b
9090
91− instance (Monad m) => Applicative m where
91+ instance applicativeFromMonad :: (Monad m) => Applicative m where
9292 pure = return
9393 (<*>) f a = do
9494 f' <- f
@@ -144,7 +144,7 @@ module Prelude where
144144 \ return -n;\
145145 \}" :: Number -> Number
146146
147− instance Num Number where
147+ instance numNumber :: Num Number where
148148 (+) = numAdd
149149 (-) = numSub
150150 (*) = numMul
@@ -159,18 +159,6 @@ module Prelude where
159159 (==) :: a -> a -> Boolean
160160 (/=) :: a -> a -> Boolean
161161
162− -- Referential equality
163− data Ref a = Ref a
164−
165− liftRef :: forall a b. (a -> a -> b) -> Ref a -> Ref a -> b
166− liftRef f (Ref x) (Ref y) = f x y
167−
168− refEq :: forall a. Ref a -> Ref a -> Boolean
169− refEq = liftRef unsafeRefEq
170−
171− refIneq :: forall a. Ref a -> Ref a -> Boolean
172− refIneq = liftRef unsafeRefIneq
173−
174162 foreign import unsafeRefEq "function unsafeRefEq(r1) {\
175163 \ return function(r2) {\
176164 \ return r1 === r2;\
@@ -183,23 +171,19 @@ module Prelude where
183171 \ };\
184172 \}" :: forall a. a -> a -> Boolean
185173
186− instance Eq (Ref a) where
187− (==) = refEq
188− (/=) = refIneq
189−
190− instance Eq String where
174+ instance eqString :: Eq String where
191175 (==) = unsafeRefEq
192176 (/=) = unsafeRefIneq
193177
194− instance Eq Number where
178+ instance eqNumber :: Eq Number where
195179 (==) = unsafeRefEq
196180 (/=) = unsafeRefIneq
197181
198− instance Eq Boolean where
182+ instance eqBoolean :: Eq Boolean where
199183 (==) = unsafeRefEq
200184 (/=) = unsafeRefIneq
201185
202− instance (Eq a) => Eq [a] where
186+ instance eqArray :: (Eq a) => Eq [a] where
203187 (==) [] [] = true
204188 (==) (x:xs) (y:ys) = x == y && xs == ys
205189 (==) _ _ = false
@@ -240,7 +224,7 @@ module Prelude where
240224 \ };\
241225 \}" :: Number -> Number -> Boolean
242226
243− instance Ord Number where
227+ instance ordNumber :: Ord Number where
244228 (<) = numLess
245229 (>) = numGreater
246230 (<=) = numLessEq
@@ -299,7 +283,7 @@ module Prelude where
299283 \ return ~n;\
300284 \}" :: Number -> Number
301285
302− instance Bits Number where
286+ instance bitsNumber :: Bits Number where
303287 (&) = numAnd
304288 (|) = numOr
305289 (^) = numXor
@@ -340,7 +324,7 @@ module Prelude where
340324 \ return !b;\
341325 \}" :: Boolean -> Boolean
342326
343− instance BoolLike Boolean where
327+ instance boolLikeBoolean :: BoolLike Boolean where
344328 (&&) = boolAnd
345329 (||) = boolOr
346330 not = boolNot
@@ -364,11 +348,11 @@ module Data.Monoid where
364348 mempty :: m
365349 (<>) :: m -> m -> m
366350
367− instance Monoid String where
351+ instance monoidString :: Monoid String where
368352 mempty = ""
369353 (<>) = (++)
370354
371− instance Monoid [a] where
355+ instance monoidArray :: Monoid [a] where
372356 mempty = []
373357 (<>) = Data.Array.concat
374358
@@ -441,20 +425,20 @@ module Data.Maybe where
441425 fromMaybe :: forall a. a -> Maybe a -> a
442426 fromMaybe a = maybe a (id :: forall a. a -> a)
443427
444− instance Monad Maybe where
428+ instance monadMaybe :: Monad Maybe where
445429 return = Just
446430 (>>=) m f = maybe Nothing f m
447431
448− instance Applicative Maybe where
432+ instance applicativeMaybe :: Applicative Maybe where
449433 pure = Just
450434 (<*>) (Just fn) x = fn <$> x
451435 (<*>) Nothing _ = Nothing
452436
453− instance Functor Maybe where
437+ instance functorMaybe :: Functor Maybe where
454438 (<$>) fn (Just x) = Just (fn x)
455439 (<$>) _ _ = Nothing
456440
457− instance (Show a) => Show (Maybe a) where
441+ instance showMaybe :: (Show a) => Show (Maybe a) where
458442 show (Just x) = "Just " ++ (show x)
459443 show Nothing = "Nothing"
460444
@@ -468,20 +452,20 @@ module Data.Either where
468452 either f _ (Left a) = f a
469453 either _ g (Right b) = g b
470454
471− instance Monad (Either e) where
455+ instance monadEither :: Monad (Either e) where
472456 return = Right
473457 (>>=) = either (\e _ -> Left e) (\a f -> f a)
474458
475− instance Applicative (Either e) where
459+ instance applicativeEither :: Applicative (Either e) where
476460 pure = Right
477461 (<*>) (Left e) _ = Left e
478462 (<*>) (Right f) r = f <$> r
479463
480− instance Functor (Either a) where
464+ instance functorEither :: Functor (Either a) where
481465 (<$>) _ (Left x) = Left x
482466 (<$>) f (Right y) = Right (f y)
483467
484− instance (Show a, Show b) => Show (Either a b) where
468+ instance showEither :: (Show a, Show b) => Show (Either a b) where
485469 show (Left x) = "Left " ++ (show x)
486470 show (Right y) = "Right " ++ (show y)
487471
@@ -576,7 +560,7 @@ module Data.Array where
576560 \ return l1;\
577561 \}" :: forall a. [a] -> [a]
578562
579− foreign import insertAt
563+ foreign import insertAt
580564 "function insertAt(index) {\
581565 \ return function(a) {\
582566 \ return function(l) {\
@@ -587,7 +571,7 @@ module Data.Array where
587571 \ };\
588572 \}":: forall a. Number -> a -> [a] -> [a]
589573
590− foreign import deleteAt
574+ foreign import deleteAt
591575 "function deleteAt(index) {\
592576 \ return function(n) {\
593577 \ return function(l) {\
@@ -598,7 +582,7 @@ module Data.Array where
598582 \ };\
599583 \}":: forall a. Number -> Number -> [a] -> [a]
600584
601− foreign import updateAt
585+ foreign import updateAt
602586 "function updateAt(index) {\
603587 \ return function(a) {\
604588 \ return function(l) {\
@@ -625,7 +609,7 @@ module Data.Array where
625609 filter _ [] = []
626610 filter p (x:xs) | p x = x : filter p xs
627611 filter p (_:xs) = filter p xs
628−
612+
629613 find :: forall a. (a -> Boolean) -> [a] -> Maybe a
630614 find _ [] = Nothing
631615 find p (x:xs) | p x = Just x
@@ -661,20 +645,40 @@ module Data.Array where
661645 take _ [] = []
662646 take n (x:xs) = x : take (n - 1) xs
663647
664− instance (Show a) => Show [a] where
648+ instance showArray :: (Show a) => Show [a] where
665649 show xs = "[" ++ joinWith (map show xs) "," ++ "]"
666650
667− instance Functor [] where
668− (<$>) = map
669−
670− instance Monad [] where
651+ instance monadArray :: Monad [] where
671652 return = singleton
672653 (>>=) = concatMap
673654
674− instance Alternative [] where
655+ instance functorArray :: Functor [] where
656+ (<$>) = map
657+
658+ instance alternativeArray :: Alternative [] where
675659 empty = []
676660 (<|>) = concat
677−
661+
662+module Data.Eq where
663+
664+ import Prelude
665+
666+ -- Referential equality
667+ data Ref a = Ref a
668+
669+ liftRef :: forall a b. (a -> a -> b) -> Ref a -> Ref a -> b
670+ liftRef f (Ref x) (Ref y) = f x y
671+
672+ refEq :: forall a. Ref a -> Ref a -> Boolean
673+ refEq = liftRef unsafeRefEq
674+
675+ refIneq :: forall a. Ref a -> Ref a -> Boolean
676+ refIneq = liftRef unsafeRefIneq
677+
678+ instance eqRef :: Eq (Ref a) where
679+ (==) = refEq
680+ (/=) = refIneq
681+
678682module Data.Array.Unsafe where
679683
680684 head :: forall a. [a] -> a
@@ -690,7 +694,7 @@ module Data.Tuple where
690694
691695 data Tuple a b = Tuple a b
692696
693− instance (Show a, Show b) => Show (Tuple a b) where
697+ instance showTuple :: (Show a, Show b) => Show (Tuple a b) where
694698 show (Tuple a b) = "Tuple(" ++ show a ++ ", " ++ show b ++ ")"
695699
696700 curry :: forall a b c. (Tuple a b -> c) -> a -> b -> c
@@ -968,7 +972,7 @@ module Control.Monad.Eff where
968972 \ return f();\
969973 \}" :: forall a. Pure a -> a
970974
971− instance Monad (Eff e) where
975+ instance monadEff :: Monad (Eff e) where
972976 return = retEff
973977 (>>=) = bindEff
974978