git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix refEq in Prelude
05d3323Phil Freeman
prelude/prelude.purs+14−14
@@ -54,11 +54,11 @@ module Prelude where
54 instance Read Boolean where
54 instance Read Boolean where
55 read "true" = true
55 read "true" = true
56 read _ = false
56 read _ = false
57−
57+
58 foreign import readNumber "function readNumber(n) {\
58 foreign import readNumber "function readNumber(n) {\
59 \ return parseInt(n, 10);\
59 \ return parseInt(n, 10);\
60 \}" :: String -> Number
60 \}" :: String -> Number
61−
61+
62 instance Read Number where
62 instance Read Number where
63 read = readNumber
63 read = readNumber
64
64
@@ -164,13 +164,13 @@ module Prelude where
164
164
165 foreign import refEq "function refEq(r1) {\
165 foreign import refEq "function refEq(r1) {\
166 \ return function(r2) {\
166 \ return function(r2) {\
167− \ return r1.value === r2.value;\
167+ \ return r1.values[0] === r2.values[0];\
168 \ };\
168 \ };\
169 \}" :: forall a. Ref a -> Ref a -> Boolean
169 \}" :: forall a. Ref a -> Ref a -> Boolean
170
170
171 foreign import refIneq "function refIneq(r1) {\
171 foreign import refIneq "function refIneq(r1) {\
172 \ return function(r2) {\
172 \ return function(r2) {\
173− \ return r1.value !== r2.value;\
173+ \ return r1.values[0] !== r2.values[0];\
174 \ };\
174 \ };\
175 \}" :: forall a. Ref a -> Ref a -> Boolean
175 \}" :: forall a. Ref a -> Ref a -> Boolean
176
176
@@ -369,7 +369,7 @@ module Monoid where
369 instance Monoid String where
369 instance Monoid String where
370 mempty = ""
370 mempty = ""
371 (<>) = (++)
371 (<>) = (++)
372−
372+
373 instance Monoid [a] where
373 instance Monoid [a] where
374 mempty = []
374 mempty = []
375 (<>) = Arrays.concat
375 (<>) = Arrays.concat
@@ -440,11 +440,11 @@ module Maybe where
440
440
441 fromMaybe :: forall a. a -> Maybe a -> a
441 fromMaybe :: forall a. a -> Maybe a -> a
442 fromMaybe a = maybe a (Prelude.id :: forall a. a -> a)
442 fromMaybe a = maybe a (Prelude.id :: forall a. a -> a)
443−
443+
444 instance Prelude.Monad Maybe where
444 instance Prelude.Monad Maybe where
445 return = Just
445 return = Just
446 (>>=) m f = maybe Nothing f m
446 (>>=) m f = maybe Nothing f m
447−
447+
448 instance Prelude.Applicative Maybe where
448 instance Prelude.Applicative Maybe where
449 pure = Just
449 pure = Just
450 (<*>) (Just fn) x = fn <$> x
450 (<*>) (Just fn) x = fn <$> x
@@ -453,7 +453,7 @@ module Maybe where
453 instance Prelude.Functor Maybe where
453 instance Prelude.Functor Maybe where
454 (<$>) fn (Just x) = Just (fn x)
454 (<$>) fn (Just x) = Just (fn x)
455 (<$>) _ _ = Nothing
455 (<$>) _ _ = Nothing
456−
456+
457 instance (Show a) => Prelude.Show (Maybe a) where
457 instance (Show a) => Prelude.Show (Maybe a) where
458 show (Just x) = "Just " ++ (show x)
458 show (Just x) = "Just " ++ (show x)
459 show Nothing = "Nothing"
459 show Nothing = "Nothing"
@@ -467,11 +467,11 @@ module Either where
467 either :: forall a b c. (a -> c) -> (b -> c) -> Either a b -> c
467 either :: forall a b c. (a -> c) -> (b -> c) -> Either a b -> c
468 either f _ (Left a) = f a
468 either f _ (Left a) = f a
469 either _ g (Right b) = g b
469 either _ g (Right b) = g b
470−
470+
471 instance Prelude.Monad (Either e) where
471 instance Prelude.Monad (Either e) where
472 return = Right
472 return = Right
473 (>>=) = either (\e _ -> Left e) (\a f -> f a)
473 (>>=) = either (\e _ -> Left e) (\a f -> f a)
474−
474+
475 instance Prelude.Applicative (Either e) where
475 instance Prelude.Applicative (Either e) where
476 pure = Right
476 pure = Right
477 (<*>) (Left e) _ = Left e
477 (<*>) (Left e) _ = Left e
@@ -480,7 +480,7 @@ module Either where
480 instance Prelude.Functor (Either a) where
480 instance Prelude.Functor (Either a) where
481 (<$>) _ (Left x) = Left x
481 (<$>) _ (Left x) = Left x
482 (<$>) f (Right y) = Right (f y)
482 (<$>) f (Right y) = Right (f y)
483−
483+
484 instance (Show a, Show b) => Prelude.Show (Either a b) where
484 instance (Show a, Show b) => Prelude.Show (Either a b) where
485 show (Left x) = "Left " ++ (show x)
485 show (Left x) = "Left " ++ (show x)
486 show (Right y) = "Right " ++ (show y)
486 show (Right y) = "Right " ++ (show y)
@@ -637,10 +637,10 @@ module Arrays where
637 instance (Prelude.Show a) => Prelude.Show [a] where
637 instance (Prelude.Show a) => Prelude.Show [a] where
638 show [] = "[]"
638 show [] = "[]"
639 show (x:xs) = show x ++ " : " ++ show xs
639 show (x:xs) = show x ++ " : " ++ show xs
640−
640+
641 instance Prelude.Functor [] where
641 instance Prelude.Functor [] where
642 (<$>) = map
642 (<$>) = map
643−
643+
644 instance Prelude.Monad [] where
644 instance Prelude.Monad [] where
645 return = singleton
645 return = singleton
646 (>>=) = concatMap
646 (>>=) = concatMap
@@ -898,7 +898,7 @@ module Math where
898 foreign import tan "function tan(n){\
898 foreign import tan "function tan(n){\
899 \ return Math.tan(n);\
899 \ return Math.tan(n);\
900 \}" :: Number -> Number
900 \}" :: Number -> Number
901−
901+
902 foreign import e "var e = Math.E;" :: Number
902 foreign import e "var e = Math.E;" :: Number
903 foreign import ln2 "var ln2 = Math.LN2;" :: Number
903 foreign import ln2 "var ln2 = Math.LN2;" :: Number
904 foreign import ln10 "var ln10 = Math.LN10;" :: Number
904 foreign import ln10 "var ln10 = Math.LN10;" :: Number