git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add (:) to prelude
commit3b68926b70c6f13286891e3387093f35dade442f authorPhil Freeman <paf31@cantab.net> dateSun 5 Jan 2014, 15:56 (13 years ago) parenta7335ba
1 file changed+6−4
libraries/prelude/prelude.purs+6−4
libraries/prelude/prelude.purs+6−4
@@ -97,8 +97,10 @@ module Arrays where
9797
9898 foreign import splice :: forall a. Number -> Number -> [a] -> [a] -> [a]
9999
100− cons :: forall a. a -> [a] -> [a]
101− cons a = concat [a]
100+ infixr 6 :
101+
102+ (:) :: forall a. a -> [a] -> [a]
103+ (:) a = concat [a]
102104
103105 concatMap :: forall a b. [a] -> (a -> [b]) -> [b]
104106 concatMap as f = {
@@ -125,7 +127,7 @@ module Arrays where
125127 }
126128
127129 zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
128− zipWith f (a:as) (b:bs) = cons (f a b) (zipWith f as bs)
130+ zipWith f (a:as) (b:bs) = f a b : zipWith f as bs
129131 zipWith _ _ _ = []
130132
131133 any :: forall a. (a -> Boolean) -> [a] -> Boolean
@@ -168,7 +170,7 @@ module Tuple where
168170
169171 unzip :: forall a b. [Tuple a b] -> Tuple [a] [b]
170172 unzip (t:ts) = case unzip ts of
171− { fst = as, snd = bs } -> tuple (cons t.fst as) (cons t.snd bs)
173+ { fst = as, snd = bs } -> tuple (t.fst : as) (t.snd : bs)
172174 unzip [] = tuple [] []
173175
174176module String where