git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Revert "Replace ++ with Semigroup in Prelude"
f8da0b9Phil Freeman
examples/passing/Operators.purs+2−1
@@ -4,7 +4,6 @@ module Main where
4 import Control.Monad.Eff
4 import Control.Monad.Eff
5 import Debug.Trace
5 import Debug.Trace
6
6
7− bar :: String -> String -> String
8 bar = \s1 s2 -> s1 ++ s2
7 bar = \s1 s2 -> s1 ++ s2
9
8
10 test1 :: forall n. (Num n) => n -> n -> (n -> n -> n) -> n
9 test1 :: forall n. (Num n) => n -> n -> (n -> n -> n) -> n
@@ -27,6 +26,8 @@ module Main where
27
26
28 test6 = ((\x -> x) `k` 2) 3
27 test6 = ((\x -> x) `k` 2) 3
29
28
29+ (<>) = \s1 s2 -> s1 ++ s2
30+
30 test7 = "Hello" <> "World!"
31 test7 = "Hello" <> "World!"
31
32
32 (@@) :: forall a b. (a -> b) -> a -> b
33 (@@) :: forall a b. (a -> b) -> a -> b
prelude/prelude.purs+5−17
@@ -325,25 +325,13 @@ module Prelude where
325 (||) = boolOr
325 (||) = boolOr
326 not = boolNot
326 not = boolNot
327
327
328− infixr 6 <>
329−
330− class Semigroup s where
331− (<>) :: s -> s -> s
332−
333 infixr 5 ++
328 infixr 5 ++
334
329
335− (++) :: forall s. (Semigroup s) => s -> s -> s
336− (++) = (<>)
337−
338− foreign import concatString
330+ foreign import (++) "function $plus$plus(s1) {\
339− "function concatString(s1) {\
340− \ return function(s2) {\
331+ \ return function(s2) {\
341− \ return s1 + s2;\
332+ \ return s1 + s2;\
342− \ };\
333+ \ };\
343− \}" :: String -> String -> String
334+ \}" :: String -> String -> String
344−
345− instance semigroupString :: Semigroup String where
346− (<>) = concatString
347
335
348module Data.Eq where
336module Data.Eq where
349
337
src/Language/PureScript/Constants.hs−6
@@ -29,9 +29,6 @@ module Language.PureScript.Constants where
29(++) :: String
29(++) :: String
30(++) = "++"
30(++) = "++"
31
31
32−(<>) :: String
33−(<>) = "<>"
34−
35(>>=) :: String
32(>>=) :: String
36(>>=) = ">>="
33(>>=) = ">>="
37
34
@@ -149,9 +146,6 @@ pokeSTArray = "pokeSTArray"
149monadEffDictionary :: String
146monadEffDictionary :: String
150monadEffDictionary = "monadEff"
147monadEffDictionary = "monadEff"
151
148
152−semigroupString :: String
153−semigroupString = "semigroupString"
154−
155numNumber :: String
149numNumber :: String
156numNumber = "numNumber"
150numNumber = "numNumber"
157
151
src/Language/PureScript/Optimizer.hs+1
@@ -64,6 +64,7 @@ optimize opts | optionsNoOptimizations opts = id
64 , inlineOperator (C.$) $ \f x -> JSApp f [x]
64 , inlineOperator (C.$) $ \f x -> JSApp f [x]
65 , inlineOperator (C.#) $ \x f -> JSApp f [x]
65 , inlineOperator (C.#) $ \x f -> JSApp f [x]
66 , inlineOperator (C.!!) $ flip JSIndexer
66 , inlineOperator (C.!!) $ flip JSIndexer
67+ , inlineOperator (C.++) $ JSBinary Add
67 , inlineCommonOperators ]
68 , inlineCommonOperators ]
68
69
69untilFixedPoint :: (Eq a) => (a -> a) -> a -> a
70untilFixedPoint :: (Eq a) => (a -> a) -> a -> a
src/Language/PureScript/Optimizer/Inliner.hs+1−4
@@ -83,10 +83,7 @@ inlineOperator op f = everywhere (mkT convert)
83
83
84inlineCommonOperators :: JS -> JS
84inlineCommonOperators :: JS -> JS
85inlineCommonOperators = applyAll
85inlineCommonOperators = applyAll
86− [ binary C.semigroupString (C.++) Add
87− , binary C.semigroupString (C.<>) Add
88−
89− , binary C.numNumber (C.+) Add
86+ [ binary C.numNumber (C.+) Add
90 , binary C.numNumber (C.-) Subtract
87 , binary C.numNumber (C.-) Subtract
91 , binary C.numNumber (C.*) Multiply
88 , binary C.numNumber (C.*) Multiply
92 , binary C.numNumber (C./) Divide
89 , binary C.numNumber (C./) Divide