-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathabstraction-semigroup.fsx
81 lines (72 loc) · 2.24 KB
/
abstraction-semigroup.fsx
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
(*** hide ***)
// This block of code is omitted in the generated HTML documentation. Use
// it to define helpers that you do not want to show in the documentation.
(**
Semigroup
=========
In mathematics, a semigroup is an algebraic structure consisting of a set together with an associative binary operation. A semigroup generalizes a monoid in that there might not exist an identity element. It also (originally) generalized a group (a monoid with all inverses) to a type where every element did not have to have an inverse, thus the name semigroup.
___
Minimal complete definition
---------------------------
* ``(+)`` / ``(++)``
*)
(**
static member (+) (x: 'Semigroup, y: 'Semigroup) : 'Semigroup
*)
(**
Rules
-----
*)
(**
(x + y) + z = x + (y + z)
*)
(**
Related Abstractions
--------------------
- [Monoid](abstraction-monoid.html): A monoid is a Semigroup with an additional ``zero`` operation
- Alt/MonadPlus: Applicatives/Monads that are also Semigroups/Monoids
Concrete implementations
------------------------
From .Net/F#
- ``list<'T>``
- ``option<'T>``
- ``voption<'T>``
- ``array<'T>``
- ``string``
- ``StringBuilder``
- ``unit``
- ``Set<'T>``
- ``Map<'T, 'U>``
- ``TimeSpan``
- ``Tuple<*>``
- ``ValueTuple<*> ( * up to 7 elements)``
- ``'T1* ... *'Tn``
- ``Task<'T>``
- ``ValueTask<'T>``
- ``'T -> 'Semigroup``
- ``Async<'T>``
- ``Expr<'T>``
- ``Lazy<'T>``
- ``Dictionary<'T, 'U>``
- ``IDictionary<'T, 'U>``
- ``IReadOnlyDictionary<'T, 'U>``
- ``ResizeArray<'T>``
- ``seq<'T>``
- ``IEnumerator<'T>``
From F#+
- [``NonEmptyList<'S>``](type-nonempty.html)
- [``NonEmptySet<'T>``](type-nonempty-set.html)
- [``NonEmptyMap<'Key, 'T>``](type-nonempty-map.html)
- [``ZipList<'S>``](type-ziplist.html)
- [``Dual<'T>``](type-dual.html)
- [``Endo<'T>``](type-endo.html)
- [``All``](type-all.html)
- [``Any``](type-any.html)
- [``Const<'C, 'T>``](type-const.html)
- [``First<'T>``](type-first.html)
- [``Last<'T>``](type-last.html)
- [``DList<'T>``](type-dlist.html)
- [``Vector<'T, 'Dimension>``](type-vector.html)
- [``Matrix<'T, 'Rows, 'Columns>``](type-matrix.html)
[Suggest another](https://github.com/fsprojects/FSharpPlus/issues/new) concrete implementation
*)