Skip to content

Commit 82215ad

Browse files
Update the readme and the changelog
1 parent c69f531 commit 82215ad

File tree

3 files changed

+64
-65
lines changed

3 files changed

+64
-65
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ Whats's new in version 3.1.0:
66

77
- .NET Standard 2.0 support was added back, but without nullable reference types
88
- Matchmaker is now built with .NET 9
9-
- Trimming is now enabled only in .NET 6+
9+
- Trimming is now enabled only for .NET 6+
10+
- `BinarryFormatter` support was removed from `MatchException`
11+
- Docs now use a new theme
12+
- Docs for older versions were removed
1013

1114
## v3.0.1
1215

Matchmaker/README.md

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
A library which enables more powerful pattern matching than is currently available in the C#'s `switch`
44
statement/expression.
55

6-
This library is a successor of [PatternMatching](https://github.com/TolikPylypchuk/PatternMatching).
7-
Version 1.x can be found there. This package contains version 2+.
6+
This library is a successor of [PatternMatching](https://github.com/TolikPylypchuk/PatternMatching). Version 1.x can be
7+
found there. This package contains version 2+.
88

99
## A Simple Example
1010

@@ -57,13 +57,12 @@ While this example doesn't show the full power of pattern matching, there are a
5757

5858
- The match expression yields a result. We don't have to assign the result explicitly in each case.
5959

60-
- The input of the match expression is specified _after_ all the cases. This allows us to save the match expression
61-
in an object, and use it multiple times on different input values.
60+
- The input of the match expression is specified _after_ all the cases. This allows us to save the match expression in
61+
an object, and use it multiple times on different input values.
6262

6363
- The default case is a pattern, just like any other. It's called `Any` and is always matched successfully.
6464

65-
- Like in `switch` the patterns are tried out sequentially. This means that the `Any` pattern should always
66-
come last.
65+
- Like in `switch` the patterns are tried out sequentially. This means that the `Any` pattern should always come last.
6766

6867
C# 8 included a new way to write `switch` expressions which yield a value, and further versions extended it quite a bit.
6968
This drastically reduced the need for external libraries like this one for pattern matching. However, this library lets
@@ -84,13 +83,13 @@ string result = i switch
8483
};
8584
```
8685

87-
OK, this is much shorter and cleaner than the previous two examples. But this library shines when the patterns are
88-
more complex. While C# allows various kinds of patterns, this library allows anything you can think of.
86+
OK, this is much shorter and cleaner than the previous two examples. But this library shines when the patterns are more
87+
complex. While C# allows various kinds of patterns, this library allows anything you can think of.
8988

9089
## Another Example
9190

92-
Let's define a simple list, implemented as [cons cells](https://en.wikipedia.org/wiki/Cons). This list is not
93-
generic for simplicity.
91+
Let's define a simple list, implemented as [cons cells](https://en.wikipedia.org/wiki/Cons). This list is not generic
92+
for simplicity.
9493

9594
```c#
9695
public abstract class ConsList
@@ -124,8 +123,8 @@ public sealed class Empty : ConsList
124123
}
125124
```
126125

127-
Now let's look what pattern matching on the list would look like. Let's create
128-
a function which finds the sum of all items of the list.
126+
Now let's look what pattern matching on the list would look like. Let's create a function which finds the sum of all
127+
items of the list.
129128

130129
```c#
131130
public int Sum(ConsList list) =>
@@ -154,13 +153,13 @@ public int Sum(ConsList list)
154153
}
155154
```
156155

157-
As you can see, we have to throw an exception in the `switch` version, because C# can't know that `ConsCell`
158-
and `Empty` are the only possible subclasses of `ConsList`. And for that reason, if we forget to define one
159-
of the cases in `switch` or in a match, we'll get an exception. In F#, a warning is issued when the match is
160-
incomplete, but C# doesn't have the notion of complete or incomplete matches.
156+
As you can see, we have to throw an exception in the `switch` version, because C# can't know that `ConsCell` and `Empty`
157+
are the only possible subclasses of `ConsList`. And for that reason, if we forget to define one of the cases in `switch`
158+
or in a match, we'll get an exception. In F#, a warning is issued when the match is incomplete, but C# doesn't have the
159+
notion of complete or incomplete matches.
161160

162-
With C# 8 there's a better way to do this, but we still have to explicitly throw an exception
163-
in the default case (which we know won't happen):
161+
With C# 8 there's a better way to do this, but we still have to explicitly throw an exception in the default case (which
162+
we know won't happen):
164163

165164
```c#
166165
public int Sum(ConsList list) =>
@@ -209,8 +208,8 @@ var result = Enumerable.Range(0, 15)
209208
## Static Match Expressions
210209

211210
One pain point of match expressions is that whenever a method which contains a match expression is executed, the match
212-
expression is initialized from scratch every time. This can be solved with static match expressions. Take a look at
213-
the revised simple example:
211+
expression is initialized from scratch every time. This can be solved with static match expressions. Take a look at the
212+
revised simple example:
214213

215214
```c#
216215
string result = Match.CreateStatic<int, string>(match => match
@@ -222,26 +221,25 @@ string result = Match.CreateStatic<int, string>(match => match
222221
.ExecuteOn(5);
223222
```
224223

225-
Now this match expression will be initialized only once even if its containing method is executed multiple times.
226-
You can read more [here](https://matchmaker.tolik.io/articles/expressions.html#static-match-expressions).
224+
Now this match expression will be initialized only once even if its containing method is executed multiple times. You
225+
can read more [here](https://matchmaker.tolik.io/articles/expressions.html#static-match-expressions).
227226

228227
## More Info
229228

230-
If you want to learn how to use this library, you should read the [documentation](https://matchmaker.tolik.io).
231-
The articles provide everything you need to know to use this library.
229+
If you want to learn how to use this library, you should read the [documentation](https://matchmaker.tolik.io). The
230+
articles provide everything you need to know to use this library.
232231

233232
If you need extensive information, go to the [API reference](https://matchmaker.tolik.io/api/index.html).
234233

235234
If you need even more info about this library, you can go through the
236-
[tests](https://github.com/TolikPylypchuk/Matchmaker/Matchmaker.Tests). They are property-based and as such
237-
they describe every aspect of the classes and their members.
235+
[tests](https://github.com/TolikPylypchuk/Matchmaker/Matchmaker.Tests). They are property-based and as such, they
236+
describe every aspect of the classes and their members.
238237

239238
## Is This Library Still Maintained?
240239

241-
I'm not planning on writing new versions beyond 3.1 (or maybe 3.2 if some stuff needs fixing). To be fair, I thought
242-
the same thing after releasing version 1.1 and yet here we are. This time I do believe that this library has enough
243-
features (probably more than enough). Maybe one day I'll revisit this decision, but for now (June 2025) this is it;
244-
this is as good as it gets.
240+
I'm not planning on writing new versions beyond 3.1. To be fair, I thought the same thing after releasing version 1.1
241+
and yet here we are. This time I do believe that this library has enough features (probably more than enough). Maybe one
242+
day I'll revisit this decision, but for now (June 2025) this is it; this is as good as it gets.
245243

246-
That said, if you report a bug or request a new feature, I'll definitely look into it. I'm not giving up on this
247-
library any time soon.
244+
That said, if you report a bug or request a new feature, I'll definitely look into it. I'm not giving up on this library
245+
any time soon.

README.md

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
A library which enables more powerful pattern matching than is currently available in the C#'s `switch`
66
statement/expression.
77

8-
This library is a successor of [PatternMatching](https://github.com/TolikPylypchuk/PatternMatching).
9-
Version 1.x can be found there. This repository contains version 2+.
8+
This library is a successor of [PatternMatching](https://github.com/TolikPylypchuk/PatternMatching). Version 1.x can be
9+
found there. This repository contains version 2+.
1010

1111
## Installation
1212

@@ -65,13 +65,12 @@ While this example doesn't show the full power of pattern matching, there are a
6565

6666
- The match expression yields a result. We don't have to assign the result explicitly in each case.
6767

68-
- The input of the match expression is specified _after_ all the cases. This allows us to save the match expression
69-
in an object, and use it multiple times on different input values.
68+
- The input of the match expression is specified _after_ all the cases. This allows us to save the match expression in
69+
an object, and use it multiple times on different input values.
7070

7171
- The default case is a pattern, just like any other. It's called `Any` and is always matched successfully.
7272

73-
- Like in `switch` the patterns are tried out sequentially. This means that the `Any` pattern should always
74-
come last.
73+
- Like in `switch` the patterns are tried out sequentially. This means that the `Any` pattern should always come last.
7574

7675
C# 8 included a new way to write `switch` expressions which yield a value, and further versions extended it quite a bit.
7776
This drastically reduced the need for external libraries like this one for pattern matching. However, this library lets
@@ -92,13 +91,13 @@ string result = i switch
9291
};
9392
```
9493

95-
OK, this is much shorter and cleaner than the previous two examples. But this library shines when the patterns are
96-
more complex. While C# allows various kinds of patterns, this library allows anything you can think of.
94+
OK, this is much shorter and cleaner than the previous two examples. But this library shines when the patterns are more
95+
complex. While C# allows various kinds of patterns, this library allows anything you can think of.
9796

9897
## Another Example
9998

100-
Let's define a simple list, implemented as [cons cells](https://en.wikipedia.org/wiki/Cons). This list is not
101-
generic for simplicity.
99+
Let's define a simple list, implemented as [cons cells](https://en.wikipedia.org/wiki/Cons). This list is not generic
100+
for simplicity.
102101

103102
```c#
104103
public abstract class ConsList
@@ -132,8 +131,8 @@ public sealed class Empty : ConsList
132131
}
133132
```
134133

135-
Now let's look what pattern matching on the list would look like. Let's create
136-
a function which finds the sum of all items of the list.
134+
Now let's look what pattern matching on the list would look like. Let's create a function which finds the sum of all
135+
items of the list.
137136

138137
```c#
139138
public int Sum(ConsList list) =>
@@ -162,13 +161,13 @@ public int Sum(ConsList list)
162161
}
163162
```
164163

165-
As you can see, we have to throw an exception in the `switch` version, because C# can't know that `ConsCell`
166-
and `Empty` are the only possible subclasses of `ConsList`. And for that reason, if we forget to define one
167-
of the cases in `switch` or in a match, we'll get an exception. In F#, a warning is issued when the match is
168-
incomplete, but C# doesn't have the notion of complete or incomplete matches.
164+
As you can see, we have to throw an exception in the `switch` version, because C# can't know that `ConsCell` and `Empty`
165+
are the only possible subclasses of `ConsList`. And for that reason, if we forget to define one of the cases in `switch`
166+
or in a match, we'll get an exception. In F#, a warning is issued when the match is incomplete, but C# doesn't have the
167+
notion of complete or incomplete matches.
169168

170-
With C# 8 there's a better way to do this, but we still have to explicitly throw an exception
171-
in the default case (which we know won't happen):
169+
With C# 8 there's a better way to do this, but we still have to explicitly throw an exception in the default case (which
170+
we know won't happen):
172171

173172
```c#
174173
public int Sum(ConsList list) =>
@@ -217,8 +216,8 @@ var result = Enumerable.Range(0, 15)
217216
## Static Match Expressions
218217

219218
One pain point of match expressions is that whenever a method which contains a match expression is executed, the match
220-
expression is initialized from scratch every time. This can be solved with static match expressions. Take a look at
221-
the revised simple example:
219+
expression is initialized from scratch every time. This can be solved with static match expressions. Take a look at the
220+
revised simple example:
222221

223222
```c#
224223
string result = Match.CreateStatic<int, string>(match => match
@@ -230,29 +229,28 @@ string result = Match.CreateStatic<int, string>(match => match
230229
.ExecuteOn(5);
231230
```
232231

233-
Now this match expression will be initialized only once even if its containing method is executed multiple times.
234-
You can read more [here](https://matchmaker.tolik.io/articles/expressions.html#static-match-expressions).
232+
Now this match expression will be initialized only once even if its containing method is executed multiple times. You
233+
can read more [here](https://matchmaker.tolik.io/articles/expressions.html#static-match-expressions).
235234

236235
## More Info
237236

238-
If you want to learn how to use this library, you should read the [documentation](https://matchmaker.tolik.io).
239-
The articles provide everything you need to know to use this library.
237+
If you want to learn how to use this library, you should read the [documentation](https://matchmaker.tolik.io). The
238+
articles provide everything you need to know to use this library.
240239

241240
If you need extensive information, go to the [API reference](https://matchmaker.tolik.io/api/index.html).
242241

243242
If you need even more info about this library, you can go through the
244-
[tests](https://github.com/TolikPylypchuk/Matchmaker/Matchmaker.Tests). They are property-based and as such
245-
they describe every aspect of the classes and their members.
243+
[tests](https://github.com/TolikPylypchuk/Matchmaker/Matchmaker.Tests). They are property-based and as such, they
244+
describe every aspect of the classes and their members.
246245

247246
## Is This Library Still Maintained?
248247

249-
I'm not planning on writing new versions beyond 3.1 (or maybe 3.2 if some stuff needs fixing). To be fair, I thought
250-
the same thing after releasing version 1.1 and yet here we are. This time I do believe that this library has enough
251-
features (probably more than enough). Maybe one day I'll revisit this decision, but for now (June 2025) this is it;
252-
this is as good as it gets.
248+
I'm not planning on writing new versions beyond 3.1. To be fair, I thought the same thing after releasing version 1.1
249+
and yet here we are. This time I do believe that this library has enough features (probably more than enough). Maybe one
250+
day I'll revisit this decision, but for now (June 2025) this is it; this is as good as it gets.
253251

254-
That said, if you report a bug or request a new feature, I'll definitely look into it. I'm not giving up on this
255-
library any time soon.
252+
That said, if you report a bug or request a new feature, I'll definitely look into it. I'm not giving up on this library
253+
any time soon.
256254

257255
## Icon
258256

0 commit comments

Comments
 (0)