/
applicative.js
62 lines (47 loc) · 1.56 KB
/
applicative.js
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
import Skb from 'components/skb-page'
export const id = "applicative"
export const title = "Scala Applicative"
export const date = "2021-01-08T17:00:11"
const scastieId = "Jmp5pWRLQxeXZwTWT7PpRw"
const mainInfoBox = <>
<p>
Let's enhance our <i>Functor</i> from few episodes ago !
</p>
<p>
Let's learn about <i>Applicative</i> which extends what a <i>Functor</i> can do.
</p>
</>
const detailedInfoBox = <>
<p>
Now we can build more complex things with the structures we know !
</p>
<p>
Keep in mind that all the rules from <i>Functor</i> are still true.
</p>
<p>
With <i>Applicative</i> we open the possibility to work with several “Boxes”. With <i>Functor</i> only, it wouldn't be possible to combine and compose them together. But with <i>Applicative</i>, we can !
</p>
<p>
With <i>Functor</i> only, if we have <code>F[A => B]</code> and <code>F[A]</code>, with <code>map</code> alone, we wouldn't be able to combine them together. But with the <code>applicate</code> method (also simply called <code>ap</code>), we can !
</p>
<p>
We are getting closer to <code>flatten</code> and <code>flatMap</code> !
</p>
</>
const description = "Scala Knowledge Bits - Scala Applicative - Periodic exercise to learn bits of knowledge about Scala. Scala Applicative here."
const prevUrl = "foldable"
const nextUrl = "covariance"
export const pageData = {
id,
title,
date,
scastieId,
mainInfoBox,
detailedInfoBox,
description,
prevUrl,
nextUrl
}
export default function Page() {
return <Skb lesson={pageData} />
}