@@ -18,57 +18,50 @@ konst = \a -> \b -> a
1818data Maybe a = Nothing | Just a
1919
2020maybe :: forall a b. b -> (a -> b) -> Maybe a -> b
21−maybe = \b -> \f -> \m -> case m of
22− Nothing -> b
23− Just a -> f a
21+maybe b _ Nothing = b
22+maybe _ f (Just a) = f a
2423
2524fromMaybe :: forall a. a -> Maybe a -> a
26−fromMaybe = \a -> maybe a id
25+fromMaybe a = maybe a id
2726
2827bindMaybe :: forall a b. Maybe a -> (a -> Maybe b) -> Maybe b
29−bindMaybe = \m -> \f -> maybe Nothing f m
28+bindMaybe m f = maybe Nothing f m
3029
3130-- Either
3231
3332data Either a b = Left a | Right b
3433
3534either :: forall a b c. (a -> c) -> (b -> c) -> Either a b -> c
36−either = \f -> \g -> \e -> case e of
37− Left a -> f a
38− Right b -> g b
35+either f _ (Left a) = f a
36+either _ g (Right b) = g b
3937
4038bindEither :: forall e a b. Either e a -> (a -> Either e b) -> Either e b
41−bindEither = either (\e -> \_ -> Left e) (\a -> \f -> f a)
39+bindEither = either (\e _ -> Left e) (\a f -> f a)
4240
4341-- Arrays
4442
4543head :: forall a. [a] -> a
46−head = \xs -> case xs of
47− x : _ -> x
44+head (x : _) = x
4845
4946headSafe :: forall a. [a] -> Maybe a
50−headSafe = \xs -> case xs of
51− x : _ -> Just x
52− _ -> Nothing
47+headSafe (x : _) = Just x
48+headSafe _ = Nothing
5349
5450tail :: forall a. [a] -> [a]
55−tail = \xs -> case xs of
56− _ : xs -> xs
51+tail (_ : xs) = xs
5752
5853tailSafe :: forall a. [a] -> Maybe [a]
59−tailSafe = \xs -> case xs of
60− _ : xs -> Just xs
61− _ -> Nothing
54+tailSafe (_ : xs) = Just xs
55+tailSafe _ = Nothing
6256
6357foreign import map :: forall a b. (a -> b) -> [a] -> [b]
6458
6559foldr :: forall a b. (a -> b -> a) -> a -> [b] -> a
66−foldr = \f -> \a -> \bs -> case bs of
67− b : bs -> f (foldr f a bs) b
68− [] -> a
60+foldr f a (b : bs) = f (foldr f a bs) b
61+foldr _ a [] = a
6962
7063foldl :: forall a b. (a -> b -> b) -> b -> [a] -> b
71−foldl = \f -> \b -> \as -> {
64+foldl f b as = {
7265 var result = b;
7366 foreach (a in as) {
7467 result = f a result;
@@ -104,7 +97,7 @@ cons :: forall a. a -> [a] -> [a]
10497cons = \a -> concat([a])
10598
10699concatMap :: forall a b. [a] -> (a -> [b]) -> [b]
107−concatMap = \as -> \f -> {
100+concatMap as f = {
108101 var result = [];
109102 foreach (a in as) {
110103 result = result `concat` f a;
@@ -115,12 +108,11 @@ concatMap = \as -> \f -> {
115108foreign import filter :: forall a. [a] -> (a -> Boolean) -> [a]
116109
117110empty :: forall a. [a] -> Boolean
118−empty = \as -> case as of
119− [] -> true
120− _ -> false
111+empty [] = true
112+empty _ = false
121113
122114range :: Number -> Number -> [Number]
123−range = \lo -> \hi -> {
115+range lo hi = {
124116 var ns = [];
125117 for (n <- lo until hi) {
126118 ns = push ns n;
@@ -129,12 +121,11 @@ range = \lo -> \hi -> {
129121 }
130122
131123zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
132−zipWith = \f -> \as -> \bs -> case { as: as, bs: bs } of
133− { as = a : as1, bs = b : bs1 } -> cons (f a b) (zipWith f as1 bs1)
134− _ -> []
124+zipWith f (a:as) (b:bs) = cons (f a b) (zipWith f as bs)
125+zipWith _ _ _ = []
135126
136127any :: forall a. (a -> Boolean) -> [a] -> Boolean
137−any = \p -> \as -> {
128+any p as = {
138129 for (i <- 0 until length as) {
139130 if (p (as !! i)) {
140131 return true;
@@ -144,7 +135,7 @@ any = \p -> \as -> {
144135 }
145136
146137all :: forall a. (a -> Boolean) -> [a] -> Boolean
147−all = \p -> \as -> {
138+all p as = {
148139 for (i <- 0 until length as) {
149140 if (!(p (as !! i))) {
150141 return false;
@@ -158,10 +149,10 @@ all = \p -> \as -> {
158149type Tuple a b = { fst :: a, snd :: b }
159150
160151curry :: forall a b c. (Tuple a b -> c) -> a -> b -> c
161−curry = \f -> \a -> \b -> f { fst: a, snd: b }
152+curry f a b = f { fst: a, snd: b }
162153
163154uncurry :: forall a b c. (a -> b -> c) -> Tuple a b -> c
164−uncurry = \f -> \t -> f t.fst t.snd
155+uncurry f t = f t.fst t.snd
165156
166157tuple :: forall a b. a -> b -> Tuple a b
167158tuple = curry id
@@ -170,10 +161,9 @@ zip :: forall a b. [a] -> [b] -> [Tuple a b]
170161zip = zipWith tuple
171162
172163unzip :: forall a b. [Tuple a b] -> Tuple [a] [b]
173−unzip = \ts -> case ts of
174− t : ts1 -> case unzip ts1 of
164+unzip (t:ts) = case unzip ts of
175165 { fst = as, snd = bs } -> tuple (cons t.fst as) (cons t.snd bs)
176− [] -> tuple [] []
166+unzip [] = tuple [] []
177167
178168-- Strings
179169