@@ -96,15 +96,15 @@ examples =
96
96
, " "
97
97
, " foreign import numberToString :: Number -> String"
98
98
, " "
99
- , " showPerson = \\ p -> case p of "
100
- , " Person o -> o. name ++ \" , aged \" ++ numberToString o. age"
99
+ , " showPerson (Person { name = name, age = age }) = "
100
+ , " name ++ \" , aged \" ++ numberToString age"
101
101
]))
102
102
, (" ops" ,
103
103
(" Operators" ,
104
104
unlines [ " infixl 5 |>"
105
105
, " "
106
106
, " (|>) :: forall a b c. (a -> b) -> (b -> c) -> a -> c"
107
- , " (|>) = \\ f -> \\ g -> \\ a -> g (f a)"
107
+ , " (|>) f g a = g (f a)"
108
108
, " "
109
109
, " foreign import foo :: String -> Number"
110
110
, " foreign import bar :: Number -> Boolean"
@@ -113,17 +113,15 @@ examples =
113
113
]))
114
114
, (" arrays" ,
115
115
(" Arrays" ,
116
- unlines [ " sum = \\ arr -> case arr of"
117
- , " x : xs -> x + sum xs"
118
- , " [] -> 0"
116
+ unlines [ " sum (x:xs) = x + sum xs"
117
+ , " sum [] = 0"
119
118
, " "
120
- , " sumOfProducts = \\ arr -> case arr of"
121
- , " x : y : xs -> x * y + sum xs"
122
- , " _ -> 0"
119
+ , " sumOfProducts (x : y : xs) = x * y + sum xs"
120
+ , " sumOfProducts _ = 0"
123
121
]))
124
122
, (" rows" ,
125
123
(" Row Polymorphism" ,
126
- unlines [ " showPerson = \\ o -> o.lastName ++ \" , \" ++ o.firstName"
124
+ unlines [ " showPerson o = o.lastName ++ \" , \" ++ o.firstName"
127
125
]))
128
126
, (" ffi" ,
129
127
(" FFI" ,
@@ -136,7 +134,7 @@ examples =
136
134
, (" blocks" ,
137
135
(" Mutable Variables" ,
138
136
unlines [ " collatz :: Number -> Number"
139
- , " collatz = \\ n -> "
137
+ , " collatz n = "
140
138
, " { "
141
139
, " var m = n;"
142
140
, " var count = 0;"
@@ -156,7 +154,7 @@ examples =
156
154
unlines [ " module Test where"
157
155
, " "
158
156
, " incr :: Number -> Number"
159
- , " incr = \\ x -> x + 1"
157
+ , " incr x = x + 1"
160
158
, " "
161
159
, " test = Test.incr 10"
162
160
]))
@@ -165,15 +163,15 @@ examples =
165
163
unlines [ " type Nat = forall a. a -> (a -> a) -> a"
166
164
, " "
167
165
, " zero :: Nat"
168
- , " zero = \\ a f -> a"
166
+ , " zero a _ = a"
169
167
, " "
170
168
, " succ :: Nat -> Nat"
171
- , " succ = \\ n a f -> f (n a f)"
169
+ , " succ n a f = f (n a f)"
172
170
, " "
173
171
, " type Lens a b = forall f. (a -> f a) -> b -> f b"
174
172
, " "
175
173
, " compose :: forall a b c. Lens a b -> Lens b c -> Lens a c"
176
- , " compose = \\ l1 l2 f -> l2 (l1 f)"
174
+ , " compose l1 l2 f = l2 (l1 f)"
177
175
]))
178
176
]
179
177
0 commit comments