You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [Functor](abstraction-functor.html): A traversable is generic on the Traversable type parameter and the (Applicative) Functor inner type parameter.
58
-
- [Applicative](abstraction-applicative.html): An applicative is a functor whose ``map`` operation can be splitted in ``return`` and ``(<*>)`` operations.
58
+
- [Applicative](abstraction-applicative.html): An applicative is a functor whose ``map`` operation can be splitted in ``return`` and ``(<*>)`` operations.
59
59
- [Foldable](abstraction-foldable.html) : All traversables are foldables.
A functor with application, providing operations to embed pure expressions (``pur``), run computations pointwise and/or paralell and combine their results (``<.>``).
10
10
___
11
11
Minimal complete definition
12
12
---------------------------
13
-
* ``pur x`` . ``result x``
13
+
* ``pur x``
14
14
* ``(<.>) f x``
15
15
*)
16
16
(**
@@ -26,40 +26,59 @@ Other operations
26
26
* ``zip``
27
27
*)
28
28
(**
29
-
static member Zip (x1: 'ZipApplicative<'T1>, x2: 'ZipApplicative<'T2>) : 'ZipApplicative<'T1 * 'T2>
29
+
static member Zip (x1: 'ZipApplicative<'T1>, x2: 'ZipApplicative<'T2>) : 'ZipApplicative<'T1 * 'T2>
Since ZipApplicatives are Applicatives they obey the same applicative rules:
61
+
52
62
pur id <.> v = v
53
63
pur (<<) <.> u <.> v <.> w = u <.> (v <.> w)
54
64
pur f <*> pur x = pur (f x)
55
65
u <*> pur y = pur ((|>) y) <.> u
56
66
*)
67
+
(**
68
+
69
+
But they have some additional rules:
70
+
71
+
zip x y = tuple2 <!> x <.> y
72
+
unzip = map fst &&& map snd
73
+
id = unzip >> (<||) zip = (<||) zip >> unzip
74
+
*)
75
+
57
76
(**
58
77
Related Abstractions
59
78
--------------------
60
79
- [Functor](abstraction-functor.html): A zipApplicative is a functor whose ``map`` operation can be splitted in ``pur`` and ``(<.>)`` operations,
61
80
62
-
- [ZipApplicative](abstraction-applicative.html) : ZipApplicatives are applicatives which usually don't form a [Monad](abstraction-monad.html).
81
+
- [Applicative](abstraction-applicative.html) : ZipApplicatives are applicatives which usually don't form a [Monad](abstraction-monad.html), therefore the Applicative instance normally is not the same.
Copy file name to clipboardExpand all lines: docsrc/content/computation-expressions.fsx
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -12,9 +12,11 @@ Computations Expressions
12
12
13
13
This library allows to use some common computation expressions without writing any boiler plate code.
14
14
15
-
For applicatives there is single computation expression: ``applicative { .. }``. Additionally ``applicative2 { .. }`` and ``applicative3 { .. }`` exists for composed (aka layered) applicatives.
15
+
For [Applicatives](abstraction-applicative.html) there is single computation expression: ``applicative { .. }``. Additionally ``applicative2 { .. }`` and ``applicative3 { .. }`` exists for composed (aka layered) applicatives.
16
16
17
-
For monadic code there is a single computation expression: ``monad { .. }`` but it comes in 4 flavours:
17
+
For [ZipApplicatives](abstraction-zipapplicative.html) there is a counterpart set of computation expressions: ``applicative' { .. }``, ``applicative2' { .. }`` and ``applicative3' { .. }``.
18
+
19
+
For [monadic](abstraction-monad.html) code there is a single computation expression: ``monad { .. }`` but it comes in 4 flavours:
0 commit comments