-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
607 lines (540 loc) · 23.3 KB
/
index.html
File metadata and controls
607 lines (540 loc) · 23.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Functional programming languages and patterns</title>
<meta name="author" content="(Bence Fábián <bence.fabian@codecool.com>)"/>
<style type="text/css">
.underline { text-decoration: underline; }
</style>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/reveal.js/3.0.0/css/reveal.css"/>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/reveal.js/3.0.0/css/theme/white.css" id="theme"/>
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'http://cdn.jsdelivr.net/reveal.js/3.0.0/css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section id="sec-title-slide"><h2 class="author">Bence Fábián <bence.fabian@codecool.com></h2><p class="date">Created: 2018-08-28 Tue 11:23</p>
</section>
<section>
<section id="slide-sec-1">
<h2 id="sec-1">The FunArg problem</h2>
<p>
Back when designing <b>ALGOL</b>
it was a question whether functions should take other functions as arguments
or return functions.
</p>
</section>
<section id="slide-sec-1-1">
<h3 id="sec-1-1">Downward FunArg</h3>
<iframe style="background-color:white;" height="500px" width= "100%" srcdoc='<html><body><pre><code class="klipse" >
<span style="color: #346604;">def</span> <span style="color: #a40000;">filter</span>(f, collection):
<span style="color: #b35000;">result</span> = []
<span style="color: #346604;">for</span> elt <span style="color: #346604;">in</span> collection:
<span style="color: #346604;">if</span> f(elt):
result.append(elt)
<span style="color: #346604;">return</span> result
<span style="color: #346604;">def</span> <span style="color: #a40000;">less_than_3</span>(elt):
<span style="color: #346604;">return</span> elt <3
<span style="color: #346604;">print</span>(<span style="color: #75507b;">filter</span>(less_than_3, [34, 2, 7, 1]))
</code></pre>
<link rel= "stylesheet" type= "text/css" href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css">
<style>
.CodeMirror { font-size: 2em; }
</style>
<script>
window.klipse_settings = { selector_eval_python_client: ".klipse" };
</script>
<script src= "https://storage.googleapis.com/app.klipse.tech/plugin_prod/js/klipse_plugin.min.js"></script></body></html>
'>
</iframe>
</section>
<section id="slide-sec-1-2">
<h3 id="sec-1-2">Upwards funarg</h3>
<iframe style="background-color:white;" height="500px" width= "100%" srcdoc='<html><body><pre><code class="klipse" >
<span style="color: #346604;">def</span> <span style="color: #a40000;">adder</span>(term):
<span style="color: #346604;">def</span> <span style="color: #a40000;">tmp</span>(x):
<span style="color: #346604;">return</span> x+term
<span style="color: #346604;">return</span> tmp
<span style="color: #b35000;">add3</span>=adder(3)
<span style="color: #346604;">print</span>(add3(5))
</code></pre>
<link rel= "stylesheet" type= "text/css" href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css">
<style>
.CodeMirror { font-size: 2em; }
</style>
<script>
window.klipse_settings = { selector_eval_python_client: ".klipse" };
</script>
<script src= "https://storage.googleapis.com/app.klipse.tech/plugin_prod/js/klipse_plugin.min.js"></script></body></html>
'>
</iframe>
<p>
Here <code>tmp</code> captures <code>term</code>.
So a closure must be created.
</p>
</section>
<section id="slide-sec-1-3">
<h3 id="sec-1-3">Combining the two</h3>
<iframe style="background-color:white;" height="500px" width= "100%" srcdoc='<html><body><pre><code class="klipse" >
<span style="color: #346604;">def</span> <span style="color: #a40000;">compose</span>(f, g):
<span style="color: #346604;">def</span> <span style="color: #a40000;">tmp</span>(x):
<span style="color: #346604;">return</span> f(g(x))
<span style="color: #346604;">return</span> tmp
<span style="color: #b35000;">num_of_fields</span> = compose(<span style="color: #75507b;">len</span>, <span style="color: #75507b;">dir</span>)
<span style="color: #346604;">print</span>(num_of_fields(<span style="color: #75507b;">__name__</span>))
</code></pre>
<link rel= "stylesheet" type= "text/css" href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css">
<style>
.CodeMirror { font-size: 2em; }
</style>
<script>
window.klipse_settings = { selector_eval_python_client: ".klipse" };
</script>
<script src= "https://storage.googleapis.com/app.klipse.tech/plugin_prod/js/klipse_plugin.min.js"></script></body></html>
'>
</iframe>
<p>
Here <code>f</code>, <code>g</code> and <code>tmp</code> are all functions.
</p>
</section>
</section>
<section>
<section id="slide-sec-2">
<h2 id="sec-2">Lisp</h2>
<p>
Lisp was inspired by <b>Church</b>'s <b>Lambda Calculus</b>
so functions were first class citizens from the get go.
</p>
</section>
<section id="slide-sec-2-1">
<h3 id="sec-2-1">Dynamic scoping</h3>
<p>
Most early implementations had dynamic scoping.
(Think of <code>this</code> in Javascript)
So passing around functions worked but variables weren't captured.
</p>
<p>
Most early lisp is not written in a style we would consider functional today.
</p>
</section>
<section id="slide-sec-2-2">
<h3 id="sec-2-2">Scheme</h3>
<p>
Developed by <b>Guy Steele</b> and <b>Gerald Sussman</b>
</p>
<p>
Two main contributions:
</p>
<ul>
<li>lexical scoping by default</li>
<li>cheap function calls</li>
</ul>
</section>
<section id="slide-sec-2-3">
<h3 id="sec-2-3">Scheme</h3>
<p>
Function calls so cheap they replace looping constructs.
</p>
<iframe style="background-color:white;" height="500px" width= "100%" srcdoc='<html><body><pre><code class="klipse" >
(<span style="color: #346604;">define</span> (<span style="color: #a40000;">fact</span> n)
(<span style="color: #346604;">define</span> (<span style="color: #a40000;">fact-helper</span> n acc)
(<span style="color: #346604;">if</span> (<= n 1) acc
(fact-helper (- n 1) (* n acc))))
(fact-helper n 1))
(fact 5)
</code></pre>
<link rel= "stylesheet" type= "text/css" href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css">
<style>
.CodeMirror { font-size: 2em; }
</style>
<script>
window.klipse_settings = { selector_eval_scheme: ".klipse" };
</script>
<script src= "https://storage.googleapis.com/app.klipse.tech/plugin_prod/js/klipse_plugin.min.js"></script></body></html>
'>
</iframe>
</section>
</section>
<section>
<section id="slide-sec-3">
<h2 id="sec-3">Lexical closures</h2>
<p>
Closure := function + environment
</p>
<iframe style="background-color:white;" height="500px" width= "100%" srcdoc='<html><body><pre><code class="klipse" >
<span style="color: #346604;">def</span> <span style="color: #a40000;">adder</span>(x, env={}):
<span style="color: #346604;">return</span> x + env[<span style="color: #5c3566;">'term'</span>]
<span style="color: #b35000;">add3</span> = { <span style="color: #5c3566;">'fun'</span>: adder,
<span style="color: #5c3566;">'env'</span>: {<span style="color: #5c3566;">'term'</span>: 3} }
<span style="color: #346604;">def</span> <span style="color: #a40000;">call_closure</span>(closure, arg):
<span style="color: #346604;">return</span> closure[<span style="color: #5c3566;">'fun'</span>](arg, closure[<span style="color: #5c3566;">'env'</span>])
<span style="color: #346604;">print</span>(call_closure(add3, 5))
</code></pre>
<link rel= "stylesheet" type= "text/css" href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css">
<style>
.CodeMirror { font-size: 2em; }
</style>
<script>
window.klipse_settings = { selector_eval_python_client: ".klipse" };
</script>
<script src= "https://storage.googleapis.com/app.klipse.tech/plugin_prod/js/klipse_plugin.min.js"></script></body></html>
'>
</iframe>
<p>
All variables are passed as arguments here.
So this would work in any language.
</p>
</section>
<section id="slide-sec-3-1">
<h3 id="sec-3-1">What do we get?</h3>
<ul>
<li>Having lexical closures (with recursion) we can build any Turing
complete language.</li>
<li>Since closures act like functions they are combinable like
functions: modularity</li>
</ul>
</section>
<section id="slide-sec-3-2">
<h3 id="sec-3-2">Example I: Objects</h3>
<iframe style="background-color:white;" height="500px" width= "100%" srcdoc='<html><body><pre><code class="klipse" >
(<span style="color: #346604;">define</span> (<span style="color: #a40000;">new_balance</span> balance)
(<span style="color: #346604;">lambda</span> (method amount)
(<span style="color: #346604;">case</span> method
((<span style="color: #5c3566;">"deposit"</span>) (set! balance (+ balance amount)))
((<span style="color: #5c3566;">"withdraw"</span>) (set! balance (- balance amount))))
balance))
(<span style="color: #346604;">define</span> <span style="color: #a40000;">my_balance</span> (new_balance 50))
(my_balance <span style="color: #5c3566;">"withdraw"</span> 23)
</code></pre>
<link rel= "stylesheet" type= "text/css" href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css">
<style>
.CodeMirror { font-size: 2em; }
</style>
<script>
window.klipse_settings = { selector_eval_scheme: ".klipse" };
</script>
<script src= "https://storage.googleapis.com/app.klipse.tech/plugin_prod/js/klipse_plugin.min.js"></script></body></html>
'>
</iframe>
</section>
<section id="slide-sec-3-3">
<h3 id="sec-3-3">Example II: Streams</h3>
<iframe style="background-color:white;" height="500px" width= "100%" srcdoc='<html><body><pre><code class="klipse" >
(<span style="color: #346604;">define</span> (<span style="color: #a40000;">new_stream</span> state iterate)
(<span style="color: #346604;">lambda</span> ()
(<span style="color: #346604;">let</span> ((old-state state))
(set! state (iterate state))
old-state)))
(<span style="color: #346604;">define</span> <span style="color: #a40000;">numbers</span>
(new_stream 1 (<span style="color: #346604;">lambda</span> (x) (+ x 1))))
(numbers)
(numbers)
(numbers)
</code></pre>
<link rel= "stylesheet" type= "text/css" href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css">
<style>
.CodeMirror { font-size: 2em; }
</style>
<script>
window.klipse_settings = { selector_eval_scheme: ".klipse" };
</script>
<script src= "https://storage.googleapis.com/app.klipse.tech/plugin_prod/js/klipse_plugin.min.js"></script></body></html>
'>
</iframe>
</section>
<section id="slide-sec-3-4">
<h3 id="sec-3-4">Example II: Streams (cont.)</h3>
<iframe style="background-color:white;" height="500px" width= "100%" srcdoc='<html><body><pre><code class="klipse" >
(<span style="color: #346604;">define</span> (<span style="color: #a40000;">new_stream</span> state iterate) (<span style="color: #346604;">lambda</span> () (<span style="color: #346604;">let</span> ((old-state state)) (set! state (iterate state)) old-state))) (<span style="color: #346604;">define</span> <span style="color: #a40000;">numbers</span> (new_stream 1 (<span style="color: #346604;">lambda</span> (x) (+ x 1))))
(<span style="color: #346604;">define</span> (<span style="color: #a40000;">filter</span> stream predicate)
(<span style="color: #346604;">lambda</span> ()
(<span style="color: #346604;">let</span> <span style="color: #a40000;">get-next</span> ((next (stream)))
(<span style="color: #346604;">if</span> (predicate next)
next
(get-next (stream))))))
(<span style="color: #346604;">define</span> <span style="color: #a40000;">evens</span> (filter numbers even?))
(<span style="color: #346604;">let*</span> ((r1 (evens))
(r2 (evens))
(r3 (evens)))
(list r1 r2 r3))
</code></pre>
<link rel= "stylesheet" type= "text/css" href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css">
<style>
.CodeMirror { font-size: 2em; }
</style>
<script>
window.klipse_settings = { selector_eval_scheme: ".klipse" };
</script>
<script src= "https://storage.googleapis.com/app.klipse.tech/plugin_prod/js/klipse_plugin.min.js"></script></body></html>
'>
</iframe>
</section>
</section>
<section>
<section id="slide-sec-4">
<h2 id="sec-4">Type systems</h2>
<p>
Are they connected to functional programming?
</p>
<p>
Well, some are, most aren't.
</p>
<p>
Then which one is?
</p>
</section>
<section id="slide-sec-4-1">
<h3 id="sec-4-1">Hindley-Milner</h3>
<ul>
<li>Type system of <code>ML</code></li>
<li>Base of type systems of <code>F#</code>, <code>OCaml</code>, <code>Scala</code>, <code>Haskell</code>, etc.</li>
</ul>
</section>
<section id="slide-sec-4-2">
<h3 id="sec-4-2">Why is it special?</h3>
<ul>
<li>It is not a designed type system, but a discovered one</li>
<li>It is based on the <code>Typed lambda calculus</code></li>
<li>Thus it is based on mathematical logic</li>
<li>A program can be typed in (near-)linear time (no need for type annotations)</li>
<li>Can be used for proofs</li>
</ul>
</section>
<section id="slide-sec-4-3">
<h3 id="sec-4-3">Type inference</h3>
<div class="org-src-container">
<pre class="src src-ocaml"><span style="color: #a52a2a;">#</span> <span style="color: #346604;">fun</span> <span style="color: #b35000;">a b c</span> <span style="color: #a52a2a;">-></span> <span style="color: #346604;">if</span> a <span style="color: #346604;">then</span> b <span style="color: #a52a2a;">*</span> 2 <span style="color: #346604;">else</span> c<span style="color: #ff4500;">;;</span>
<span style="color: #a52a2a;">-</span> <span style="color: #a52a2a;">:</span> bool <span style="color: #a52a2a;">-></span> int <span style="color: #a52a2a;">-></span> int <span style="color: #a52a2a;">-></span> int <span style="color: #a52a2a;">=</span> <span style="color: #a52a2a;"><</span><span style="color: #346604;">fun</span><span style="color: #a52a2a;">></span>
</pre>
</div>
<ul>
<li><b>a</b> <span class="underline">must be</span> a <b>bool</b> because it is used as the condition in an
<b>if</b> expression</li>
<li><b>b</b> <span class="underline">must be</span> an integer cause it is multiplied by <code>2</code></li>
<li><b>c</b> <span class="underline">must be</span> an integer as well because it has to have the same
type as the result of <code>b * 2</code></li>
</ul>
<p>
(in functional languages <code>if</code> is an expression, more similar to the
ternary operator than <code>if</code> statements in mainstream languages)
</p>
</section>
<section id="slide-sec-4-4">
<h3 id="sec-4-4">Type parameters</h3>
<div class="org-src-container">
<pre class="src src-ocaml"><span style="color: #a52a2a;">#</span> <span style="color: #346604;">fun</span> <span style="color: #b35000;">a b c</span> <span style="color: #a52a2a;">-></span> <span style="color: #346604;">if</span> a <span style="color: #346604;">then</span> b <span style="color: #346604;">else</span> c<span style="color: #ff4500;">;;</span>
<span style="color: #a52a2a;">-</span> <span style="color: #a52a2a;">:</span> bool <span style="color: #a52a2a;">-></span> 'a <span style="color: #a52a2a;">-></span> 'a <span style="color: #a52a2a;">-></span> 'a <span style="color: #a52a2a;">=</span> <span style="color: #a52a2a;"><</span><span style="color: #346604;">fun</span><span style="color: #a52a2a;">></span>
</pre>
</div>
<ul>
<li><b>a</b> <span class="underline">must be</span> a <b>bool</b> because it is used as the condition in an
<b>if</b> expression</li>
<li><b>b</b> and <b>c</b> can be <span class="underline">any</span> type here as long as they are the <span class="underline">same</span>
type</li>
</ul>
<p>
'a here is a type parameter
</p>
</section>
<section id="slide-sec-4-5">
<h3 id="sec-4-5">Parametricity</h3>
<p>
Having type parameters can make some types so general, that there are
only one or two values which can fulfil that type.
</p>
<div class="org-src-container">
<pre class="src src-ocaml">f<span style="color: #a52a2a;">:</span> 'a <span style="color: #a52a2a;">-></span> 'a
</pre>
</div>
<p>
Has only one possible implementation: the identity function.
</p>
<div class="org-src-container">
<pre class="src src-ocaml"><span style="color: #346604;">fun</span> <span style="color: #b35000;">x</span> <span style="color: #a52a2a;">-></span> x<span style="color: #ff4500;">;;</span>
</pre>
</div>
<p>
While
</p>
<div class="org-src-container">
<pre class="src src-ocaml">g<span style="color: #a52a2a;">:</span> <span style="color: #a52a2a;">(</span>'b <span style="color: #a52a2a;">-></span> 'c<span style="color: #a52a2a;">)</span> <span style="color: #a52a2a;">-></span> <span style="color: #a52a2a;">(</span>'a <span style="color: #a52a2a;">-></span> 'b<span style="color: #a52a2a;">)</span> <span style="color: #a52a2a;">-></span> <span style="color: #a52a2a;">(</span>'a <span style="color: #a52a2a;">-></span> 'c<span style="color: #a52a2a;">)</span>
</pre>
</div>
<p>
Has only one possible implementation as well: function composition.
</p>
<div class="org-src-container">
<pre class="src src-ocaml"><span style="color: #346604;">fun</span> <span style="color: #b35000;">f g</span> <span style="color: #a52a2a;">-></span> <span style="color: #346604;">fun</span> <span style="color: #b35000;">x</span> <span style="color: #a52a2a;">-></span> f <span style="color: #a52a2a;">(</span>g x<span style="color: #a52a2a;">)</span><span style="color: #ff4500;">;;</span>
</pre>
</div>
</section>
<section id="slide-sec-4-6">
<h3 id="sec-4-6">Proof of correctness</h3>
<p>
The richer a type system is, the less things have to be checked at runtime.
</p>
<p>
With a <b>Dependent type system</b> the type of vector concatenation is
</p>
<div class="org-src-container">
<pre class="src src-haskell">conc <span style="color: #a40000;">:</span> <span style="color: #204a87;">Vect</span> n a <span style="color: #b35000;">-></span> <span style="color: #204a87;">Vect</span> m a <span style="color: #b35000;">-></span> <span style="color: #204a87;">Vect</span> (n<span style="color: #b35000;">+</span>m) a
</pre>
</div>
<p>
Where the first parameter is the length of the vector.
</p>
<p>
The type of an empty Vector is <code>Vect 0 a</code>
</p>
<p>
(this example is in <a href="https://www.idris-lang.org/">idris</a>)
</p>
</section>
<section id="slide-sec-4-7">
<h3 id="sec-4-7">Lying types</h3>
<div class="org-src-container">
<pre class="src src-ocaml"><span style="color: #a52a2a;">></span> <span style="color: #000000; font-weight: bold;">open </span><span style="color: #204a87;">System</span><span style="color: #ff4500;">;;</span>
<span style="color: #a52a2a;">></span> <span style="color: #204a87;">Console.</span><span style="color: #2e3436; background-color: #eeeeec;">ReadLine</span><span style="color: #ff4500;">;;</span>
<span style="color: #000000; font-weight: bold;">val</span> <span style="color: #a40000;">it</span> <span style="color: #a52a2a;">:</span> unit <span style="color: #a52a2a;">-></span> string <span style="color: #a52a2a;">=</span> <span style="color: #a52a2a;"><</span><span style="color: #346604;">fun</span><span style="color: #a52a2a;">:</span>clo<span style="color: #a52a2a;">@</span>8<span style="color: #a52a2a;">-</span>2<span style="color: #a52a2a;">></span>
</pre>
</div>
<p>
According to its type <code>ReadLine</code> in <b>F#</b> creates a <code>string</code> out of the
type <code>unit</code> which has only one value: <code>()</code>.
</p>
</section>
<section id="slide-sec-4-8">
<h3 id="sec-4-8">Side effects</h3>
<p>
Programming language functions are not real functions.
They have side-effects:
</p>
<ul>
<li>doing IO</li>
<li>changing state</li>
<li>raising exceptions</li>
<li>etc</li>
</ul>
</section>
<section id="slide-sec-4-9">
<h3 id="sec-4-9">Controlling side effects</h3>
<p>
<b>Haskell</b> has a type system where side effects are explicit.
</p>
<p>
The function <code>putStr</code> has the type
</p>
<div class="org-src-container">
<pre class="src src-haskell"><span style="color: #a40000;">putStrLn</span> <span style="color: #b35000;">::</span> <span style="color: #204a87;">String</span> <span style="color: #b35000;">-></span> <span style="color: #204a87;">IO</span> <span style="color: #204a87;">()</span>
</pre>
</div>
<p>
It takes a <code>String</code> and returns an IO action (which wraps unit)
</p>
<p>
Here IO happening is explicit.
</p>
</section>
<section id="slide-sec-4-10">
<h3 id="sec-4-10">Creating side effects</h3>
<p>
If the handling of side effects is formalized then new kind of side
effects can be added to the language.
</p>
<p>
For example exceptions, or probabilistic computations can be added to
a language which doesn't have them originally.
</p>
</section>
</section>
<section>
<section id="slide-sec-5">
<h2 id="sec-5">Conclusion</h2>
<p>
It is worth to look into functional techniques when you need
</p>
<ul>
<li><b>Modularity and extensibility:</b> to have composable parts which are
easily understandable and scalable.</li>
<li><b>Program correctness:</b> to have some proof that our program is doing
what we have intended.</li>
</ul>
<p>
You might not need a functional language. Most of these techniques
can be done in modern mainstream languages.
</p>
</section>
<section id="slide-sec-5-1">
<h3 id="sec-5-1">Q & A</h3>
<p>
Do you have any questions?
</p>
</section>
<section id="slide-sec-5-2">
<h3 id="sec-5-2">Thank you for your attention</h3>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="left" />
<col class="left" />
</colgroup>
<tbody>
<tr>
<td class="left">Twitter</td>
<td class="left"><a href="https://twitter.com/onkel_benec">@onkel_benec</a></td>
</tr>
<tr>
<td class="left">Github</td>
<td class="left"><a href="https://github.com/bencef">bencef</a></td>
</tr>
</tbody>
</table>
<p>
Do you want to see some haskell?
</p>
</section>
</section>
</div>
</div>
<script src="http://cdn.jsdelivr.net/reveal.js/3.0.0/lib/js/head.min.js"></script>
<script src="http://cdn.jsdelivr.net/reveal.js/3.0.0/js/reveal.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: false,
center: true,
slideNumber: 'c',
rollingLinks: false,
keyboard: true,
overview: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'slide', // default/cube/page/concave/zoom/linear/fade/none
transitionSpeed: 'default',
multiplex: {
secret: '', // null if client
id: '', // id, obtained from socket.io server
url: '' // Location of socket.io server
},
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }]
});
</script>
</body>
</html>