git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add show instance for Array to prelude
commitb5d15c00b7fdee0a9bfb11f419a0902e3c68ea5e authorGary Burgess <gary.burgess@gmail.com> dateFri 11 Apr 2014, 20:13 (13 years ago) parent493f9ae
1 file changed+17−3
prelude/prelude.purs+17−3
prelude/prelude.purs+17−3
@@ -38,9 +38,9 @@ module Prelude where
3838
3939 (#) :: forall a b. a -> (a -> b) -> b
4040 (#) x f = f x
41−
41+
4242 infixr 6 :
43−
43+
4444 (:) :: forall a. a -> [a] -> [a]
4545 (:) = cons
4646
@@ -73,6 +73,20 @@ module Prelude where
7373 instance showNumber :: Show Number where
7474 show = showNumberImpl
7575
76+ foreign import showArrayImpl
77+ "function showArrayImpl (f) {\
78+ \ return function (xs) {\
79+ \ var ss = [];\
80+ \ for (var i = 0, l = xs.length; i < l; i++) {\
81+ \ ss[i] = f(xs[i]);\
82+ \ }\
83+ \ return '[' + ss.join(',') + ']';\
84+ \ };\
85+ \}" :: forall a. (a -> String) -> [a] -> String
86+
87+ instance showArray :: (Show a) => Show [a] where
88+ show = showArrayImpl show
89+
7690 infixl 4 <$>
7791
7892 class Functor f where
@@ -388,7 +402,7 @@ module Data.Eq where
388402 instance eqRef :: Eq (Ref a) where
389403 (==) = liftRef refEq
390404 (/=) = liftRef refIneq
391−
405+
392406module Prelude.Unsafe where
393407
394408 foreign import unsafeIndex