@@ -15,7 +15,7 @@ module Prelude where
1515 (<|) :: forall a b c. (b -> c) -> (a -> b) -> a -> c
1616 (<|) = flip (|>)
1717
18− -- Maybe
18+module Maybe where
1919
2020 data Maybe a = Nothing | Just a
2121
@@ -24,12 +24,12 @@ module Prelude where
2424 maybe _ f (Just a) = f a
2525
2626 fromMaybe :: forall a. a -> Maybe a -> a
27− fromMaybe a = maybe a id
27+ fromMaybe a = maybe a Prelude.id
2828
2929 bindMaybe :: forall a b. Maybe a -> (a -> Maybe b) -> Maybe b
3030 bindMaybe m f = maybe Nothing f m
3131
32− -- Either
32+module Either where
3333
3434 data Either a b = Left a | Right b
3535
@@ -40,7 +40,9 @@ module Prelude where
4040 bindEither :: forall e a b. Either e a -> (a -> Either e b) -> Either e b
4141 bindEither = either (\e _ -> Left e) (\a f -> f a)
4242
43− -- Arrays
43+module Arrays where
44+
45+ import Maybe
4446
4547 head :: forall a. [a] -> a
4648 head (x : _) = x
@@ -96,7 +98,7 @@ module Prelude where
9698 foreign import splice :: forall a. Number -> Number -> [a] -> [a] -> [a]
9799
98100 cons :: forall a. a -> [a] -> [a]
99− cons = \a -> concat([a])
101+ cons a = concat [a]
100102
101103 concatMap :: forall a b. [a] -> (a -> [b]) -> [b]
102104 concatMap as f = {
@@ -146,7 +148,9 @@ module Prelude where
146148 return true;
147149 }
148150
149− -- Pairs
151+module Tuple where
152+
153+ import Arrays
150154
151155 type Tuple a b = { fst :: a, snd :: b }
152156
@@ -157,7 +161,7 @@ module Prelude where
157161 uncurry f t = f t.fst t.snd
158162
159163 tuple :: forall a b. a -> b -> Tuple a b
160− tuple = curry id
164+ tuple = curry Prelude.id
161165
162166 zip :: forall a b. [a] -> [b] -> [Tuple a b]
163167 zip = zipWith tuple
@@ -167,7 +171,7 @@ module Prelude where
167171 { fst = as, snd = bs } -> tuple (cons t.fst as) (cons t.snd bs)
168172 unzip [] = tuple [] []
169173
170− -- Strings
174+module String where
171175
172176 foreign import member "length" lengthS :: String -> Number
173177
@@ -195,7 +199,7 @@ module Prelude where
195199
196200 foreign import trim :: String -> String
197201
198− -- Regex
202+module Regex where
199203
200204 foreign import data Regex :: *
201205
@@ -209,7 +213,7 @@ module Prelude where
209213
210214 foreign import search :: Regex -> String -> Number
211215
212− -- Globals
216+module Global where
213217
214218 foreign import nan :: Number
215219
@@ -239,7 +243,7 @@ module Prelude where
239243
240244 foreign import decodeURI :: String -> String
241245
242− -- Math
246+module Math where
243247
244248 type Math =
245249 { abs :: Number -> Number