Skip to content

Commit fdf2c29

Browse files
Replace em dashes with en dashes
1 parent 2085239 commit fdf2c29

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

docs/articles/expressions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ A match expression can be created using the `Create` methods of the static class
1313
### Adding Cases
1414

1515
The `Match` classes include `Case` methods which are used to add a pattern and a function which is executed if the match
16-
is successful. Match expressions are immutable `Case` methods return new match expressions; they do not affect the
16+
is successful. Match expressions are immutable `Case` methods return new match expressions; they do not affect the
1717
ones on which they are called.
1818

19-
`Case` methods are generic they also contain information about the pattern's transformation type. Match expressions
19+
`Case` methods are generic they also contain information about the pattern's transformation type. Match expressions
2020
can contain patterns of arbitrary transformation types without knowing about these types.
2121

2222
### Executing Match Expressions
@@ -31,7 +31,7 @@ which executes the match expression in the non-strict mode. It returns `MatchRes
3131
not be present.
3232

3333
In the `Match<TInput>` class, the `ExecuteOn` method doesn't return anything, and also throws a `MatchException` if the
34-
match wasn't successful. This class also contains the `ExecuteNonStrict` method it returns a boolean value which
34+
match wasn't successful. This class also contains the `ExecuteNonStrict` method it returns a boolean value which
3535
indicates whether the match was successful and doesn't throw an exception if it wasn't.
3636

3737
The `ToFunction` method and its variations are also available. They return a function which, when called, will execute
@@ -55,7 +55,7 @@ the expression will stop at this pattern and not go any further.
5555
`Match.Create` is also overloaded to take the default fall-through behavior.
5656

5757
Matching with fall-through is lazy, i.e., it returns an `IEnumerable` and is only executed when this enumerable is
58-
enumerated. Because matching will fall-through is lazy, it doesn't have any modes of execution the user must decide
58+
enumerated. Because matching will fall-through is lazy, it doesn't have any modes of execution the user must decide
5959
whether to throw an exception or not if there were no successful matches.
6060

6161
In the `Match<TInput, TOutput>` class, the `ExecuteWithFallthrough` method returns an `IEnumerable<TOutput>` which can
@@ -129,7 +129,7 @@ less readable because the case definitions are in a different place from the act
129129

130130
### The Solution
131131

132-
There is a way to create static match expressions expressions which will be initialized only once.
132+
There is a way to create static match expressions expressions which will be initialized only once.
133133

134134
The `Match` class contains the `CreateStatic` methods which allow the creation of static match expressions. Take a look
135135
at the modified example:
@@ -150,7 +150,7 @@ only once, and its initialization code is in the same place as its execution poi
150150

151151
The parameter of the build action has the type `MatchBuilder<TInput, TOutput` or `MatchBuilder<TInput>`, depending on
152152
which type of match expressions you are building. This type has the same methods for adding cases as the `Match` classes
153-
and is mutable the methods return the same builder instance.
153+
and is mutable the methods return the same builder instance.
154154

155155
`MatchBuilder` also has the `Fallthrough` method which specifies the default fall-through behavior. But this method
156156
specifies fall-through behavior only for cases that are defined after it. For example:

docs/articles/patterns.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ The `Match` method actually does two things:
1919
- Matches the input value with the pattern and returns a successful result if the match is successful.
2020
- Transforms the input value. The returned result contains the transformed value if it's successful.
2121

22-
Since options are not supported natively in C#, a custom type [`MatchResult<T>`](results.md) is used.
22+
Since options are not supported natively in C#, a custom type [`MatchResult<T>`](results.md) is used.
2323

2424
The definition of patterns is similar to F#'s active patterns.
2525

26-
Descriptions for patterns are not terribly important, but can be useful for debugging. As such, they are optional if
26+
Descriptions for patterns are not terribly important, but can be useful for debugging. As such, they are optional if
2727
you don't want a pattern to have a description, it should be empty. A pattern's description should never be `null`.
2828

2929
## Null Values
@@ -59,7 +59,7 @@ All methods for getting predefined patterns are overloaded to take a custom desc
5959
The `Matchmaker.Linq` namespace provides several extension methods for patterns:
6060

6161
- `Select` maps a pattern's result value if it's successful.
62-
- `Pipe` creates a pattern pipeline the result of the first pattern is the input of the second pattern.
62+
- `Pipe` creates a pattern pipeline the result of the first pattern is the input of the second pattern.
6363
- `Cast` casts a pattern's result to a specified type. It's the same as piping a pattern to the `Type` pattern. If the
6464
input is `null`, then the match will fail only if the destination type is a non-nullable value type.
6565
- `Bind` flat-maps a pattern's result. If a pattern's result is successful, it calls the specified function and passes
@@ -70,7 +70,7 @@ result is the final result.
7070
the input if successful.
7171
- `Compose` is the same as the three methods above, but the composition operator is passed to it as well.
7272
- `Cached` returns a pattern which matches the same as the specified pattern but caches its results in a `null`-safe
73-
hash table. Every input will be matched only once if it's matched again, the result will be taken from the cache. The
73+
hash table. Every input will be matched only once if it's matched again, the result will be taken from the cache. The
7474
caching process is not thread-safe.
7575

7676
All extension methods for patterns are overloaded to take a custom description.
@@ -83,9 +83,9 @@ a combination of the Reader and Maybe monads.
8383
## Immutability
8484

8585
All predefined patterns, as well as patterns returned by `CreatePattern` and extension methods, are immutable. Calling
86-
an extension method on a pattern returns a new pattern the old one is unchanged.
86+
an extension method on a pattern returns a new pattern the old one is unchanged.
8787

88-
An exception is the pattern returned by the `Cached` method, which is not immutable it holds a mutable cache. But if a
88+
An exception is the pattern returned by the `Cached` method, which is not immutable it holds a mutable cache. But if a
8989
pattern is referentially transparent (its `Match` method always returns the same result for the same input and doesn't
9090
have any side effects), then the caching pattern based on it can be thought of as immutable as well, because it doesn't
9191
matter how many times the base pattern's `Match` method is called.
@@ -109,7 +109,7 @@ There are also overloads which take a description.
109109

110110
If you want something more complex than a single function, you can create a class which extends the
111111
`Matchmaker.Patterns.Pattern<TInput, TMatchResult>` class. This is a base class for patterns, and it implements the
112-
`Description` property which you don't have to use if you don't want by default the description is empty, which means
112+
`Description` property which you don't have to use if you don't want by default the description is empty, which means
113113
that the pattern doesn't have a description.
114114

115115
You can also implement the `IPattern<TInput, TMatchResult>` interface directly. There is no reason to do that instead of

docs/articles/why.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44

55
Pattern matching as a technique was created to make code which operates on data more succinct, clear, and readable. I
66
have to say, I'm not sure this library achieves this. There's no denying that this library is cumbersome, and some
7-
features are kind of convoluted. You can certainly use it if you want to it's extensively tested. But this is more of
8-
an experimental effort I wanted to see how powerful pattern matching can be in C#. In this article I'll try to explain
7+
features are kind of convoluted. You can certainly use it if you want to it's extensively tested. But this is more of
8+
an experimental effort I wanted to see how powerful pattern matching can be in C#. In this article I'll try to explain
99
some reasons behind the features of this library. This is not documentation per se, it's more of a thought piece about
1010
this library and a recap of its history.
1111

1212
Also, I should note that I haven't checked out any other pattern matching libraries for C#. I'm sure there are a lot of
13-
them I can't be the only one who tried to bring this technique into C#. But I wanted to create something by myself and
13+
them I can't be the only one who tried to bring this technique into C#. But I wanted to create something by myself and
1414
not get inspired by (read: steal) features from the other libraries as I'm sure there's not actually much space for
1515
stretching here. Some pattern matching libraries are probably better than this one and I'm okay with it.
1616

1717
## Background
1818

1919
In the end of 2017, after studying F# and functional programming, I've decided to try to bring some functional features
20-
into C#. I've created a small library for C# and named it [CSX C# Extensions](https://github.com/TolikPylypchuk/CSX).
20+
into C#. I've created a small library for C# and named it [CSX C# Extensions](https://github.com/TolikPylypchuk/CSX).
2121
I worked on this library just for the fun of it and never intended for it to be anything serious. I've long since
2222
stopped doing anything with it, because I've realized that it required a lot of work. My implementations of functional
2323
data structures were quite naive, and I've decided that I don't want to invest time into optimizing them. Moreover, I
@@ -81,8 +81,8 @@ nor reflection. And to be honest, at that moment I felt dumb, because I haven't
8181
solution was obvious.
8282

8383
In this version, I've also completely uprooted the pattern hierarchy and made working with them much easier. I've also
84-
added some primitive caching. I'm not an expert on caching this can be an extensive topic of research so I can't
85-
say that caching in this library is great it's okay at best. If you need more extensive or better caching of match
84+
added some primitive caching. I'm not an expert on caching this can be an extensive topic of research so I can't
85+
say that caching in this library is great it's okay at best. If you need more extensive or better caching of match
8686
expressions, you can create an issue (or better yet, a pull request) on GitHub. I will most definitely respond and will
8787
do my best to implement it.
8888

@@ -104,7 +104,7 @@ it would break any actual code.
104104
After releasing version 2.1.0, I started working on version 3.0.0 which contains 2 major additions: support for nullable
105105
reference types and asynchronous pattern matching. Because of those additions, the .NET Standard version had to be
106106
bumped to 2.1 (sorry, .NET Framework). Asynchronous pattern matching will probably not be used often. I wrote it simply
107-
because I can, and why not we have asynchronous enumeration, asynchronous disposal, asynchronous almost everything,
107+
because I can, and why not we have asynchronous enumeration, asynchronous disposal, asynchronous almost everything,
108108
so why not asynchronous pattern matching?
109109

110110
Five years after releasing version 3.0.0, I've decided to release version 3.1.0 which adds support for .NET Standard 2.0

0 commit comments

Comments
 (0)