@@ -8,7 +8,7 @@ module Prelude where
88
99 on :: forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c
1010 on f g x y = g x `f` g y
11−
11+
1212 asTypeOf :: forall a. a -> a -> a
1313 asTypeOf x _ = x
1414
@@ -59,7 +59,7 @@ module Prelude where
5959
6060 infixl 4 <*>
6161
62− class Applicative f where
62+ class (Functor f) <= Applicative f where
6363 pure :: forall a. a -> f a
6464 (<*>) :: forall a b. f (a -> b) -> f a -> f b
6565
@@ -74,7 +74,7 @@ module Prelude where
7474
7575 infixl 1 >>=
7676
77− class Monad m where
77+ class (Applicative m) <= Monad m where
7878 return :: forall a. a -> m a
7979 (>>=) :: forall a b. m a -> (a -> m b) -> m b
8080
@@ -192,7 +192,7 @@ module Prelude where
192192 show GT = "GT"
193193 show EQ = "EQ"
194194
195− class Ord a where
195+ class (Eq a) <= Ord a where
196196 compare :: a -> a -> Ordering
197197
198198 infixl 4 <
@@ -334,11 +334,18 @@ module Prelude where
334334
335335 infixr 5 ++
336336
337− foreign import (++) "function $plus$plus(s1) {\
338− \ return function(s2) {\
339− \ return s1 + s2;\
340− \ };\
341− \}" :: String -> String -> String
337+ class Semigroup a where
338+ (++) :: a -> a -> a
339+
340+ foreign import concatString
341+ "function concatString(s1) {\
342+ \ return function(s2) {\
343+ \ return s1 + s2;\
344+ \ };\
345+ \}" :: String -> String -> String
346+
347+ instance semigroupString :: Semigroup String where
348+ (++) = concatString
342349
343350module Data.Eq where
344351