Skip to content

Commit ea3ae26

Browse files
committed
Remove parentheses around em-dash
1 parent ffb94ae commit ea3ae26

37 files changed

+71
-71
lines changed

Diff for: _overviews/scala3-book/ca-given-imports.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object B:
3434

3535
## Discussion
3636

37-
The wildcard selector `_` brings all definitions other than givens or extensions into scope, whereas a `given` selector brings all *givens* --- including those resulting from extensions --- into scope.
37+
The wildcard selector `_` brings all definitions other than givens or extensions into scope, whereas a `given` selector brings all *givens*---including those resulting from extensions---into scope.
3838

3939
These rules have two main benefits:
4040

Diff for: _overviews/scala3-book/ca-type-classes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ next-page: ca-multiversal-equality
1111
A *type class* is an abstract, parameterized type that lets you add new behavior to any closed data type without using sub-typing.
1212
This is useful in multiple use-cases, for example:
1313

14-
- Expressing how a type you don’t own --- from the standard library or a third-party library --- conforms to such behavior
14+
- Expressing how a type you don’t own---from the standard library or a third-party library---conforms to such behavior
1515
- Expressing such a behavior for multiple types without involving sub-typing relationships between those types
1616

1717
In Scala 3, type classes are just traits with one or more parameters whose implementations are provided by `given` instances.

Diff for: _overviews/scala3-book/collections-classes.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ As shown, `Map` and `Set` come in both immutable and mutable versions.
6363

6464
The basics of each type are demonstrated in the following sections.
6565

66-
> In Scala, a _buffer_ --- such as `ArrayBuffer` and `ListBuffer` --- is a sequence that can grow and shrink.
66+
> In Scala, a _buffer_---such as `ArrayBuffer` and `ListBuffer`---is a sequence that can grow and shrink.
6767
6868

6969
### A note about immutable collections
@@ -75,7 +75,7 @@ With these types you don’t modify the collection; you apply functional methods
7575

7676
## Choosing a sequence
7777

78-
When choosing a _sequence_ --- a sequential collection of elements --- you have two main decisions:
78+
When choosing a _sequence_---a sequential collection of elements---you have two main decisions:
7979

8080
- Should the sequence be indexed (like an array), allowing rapid access to any element, or should it be implemented as a linear linked list?
8181
- Do you want a mutable or immutable collection?
@@ -232,7 +232,7 @@ This works because a `List` is a singly-linked list that ends with the `Nil` ele
232232
### Aside: The LazyList
233233

234234
The Scala collections also include a [LazyList](https://www.scala-lang.org/api/current/scala/collection/immutable/LazyList.html), which is a _lazy_ immutable linked list.
235-
It’s called “lazy” --- or non-strict --- because it computes its elements only when they are needed.
235+
It’s called “lazy”---or non-strict---because it computes its elements only when they are needed.
236236

237237
You can see how lazy a `LazyList` is in the REPL:
238238

Diff for: _overviews/scala3-book/collections-methods.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ a.find(_ > 20) // Some(30)
9090
a.takeWhile(_ < 30) // List(10, 20)
9191
```
9292

93-
It’s important to note that HOFs also accept methods and functions as parameters --- not just lambda expressions.
93+
It’s important to note that HOFs also accept methods and functions as parameters---not just lambda expressions.
9494
Here are some examples of the `map` HOF that uses a method named `double`.
9595
Several variations of the lambda syntax are shown again:
9696

@@ -402,7 +402,7 @@ scala> a.reduce(_ * _)
402402
res1: Int = 24
403403
```
404404

405-
> An important concept to know about `reduce` is that --- as its name implies --- it’s used to _reduce_ a collection down to a single value.
405+
> An important concept to know about `reduce` is that---as its name implies---it’s used to _reduce_ a collection down to a single value.
406406
407407

408408

Diff for: _overviews/scala3-book/concurrency.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ next-page: scala-tools
88
---
99

1010

11-
When you want to write parallel and concurrent applications in Scala, you _can_ use the native Java `Thread` --- but the Scala [Future](https://www.scala-lang.org/api/current/scala/concurrent/Future$.html) offers a more high level and idiomatic approach so it’s preferred, and covered in this chapter.
11+
When you want to write parallel and concurrent applications in Scala, you _can_ use the native Java `Thread`---but the Scala [Future](https://www.scala-lang.org/api/current/scala/concurrent/Future$.html) offers a more high level and idiomatic approach so it’s preferred, and covered in this chapter.
1212

1313

1414

@@ -35,7 +35,7 @@ def aLongRunningTask(): Future[Int] = ???
3535
val x = aLongRunningTask()
3636
```
3737

38-
But the main difference in this case is that because `aLongRunningTask` takes an indeterminate amount of time to return, the value in `x` may or may not be _currently_ available, but it will be available at some point --- in the future.
38+
But the main difference in this case is that because `aLongRunningTask` takes an indeterminate amount of time to return, the value in `x` may or may not be _currently_ available, but it will be available at some point---in the future.
3939

4040
Another way to look at this is in terms of blocking.
4141
In this single-threaded example, the `println` statement isn’t printed until `aShortRunningTask` completes:
@@ -48,7 +48,7 @@ val x = aShortRunningTask()
4848
println("Here")
4949
```
5050

51-
Conversely, if `aShortRunningTask` is created as a `Future`, the `println` statement is printed almost immediately because `aShortRunningTask` is spawned off on some other thread --- it doesn’t block.
51+
Conversely, if `aShortRunningTask` is created as a `Future`, the `println` statement is printed almost immediately because `aShortRunningTask` is spawned off on some other thread---it doesn’t block.
5252

5353
In this chapter you’ll see how to use futures, including how to run multiple futures in parallel and combine their results in a `for` expression.
5454
You’ll also see examples of methods that are used to handle the value in a future once it returns.
@@ -62,7 +62,7 @@ You’ll also see examples of methods that are used to handle the value in a fut
6262
## An example in the REPL
6363

6464
A future is used to create a temporary pocket of concurrency.
65-
For instance, you use a future when you need to call an algorithm that runs an indeterminate amount of time --- such as calling a remote microservice --- so you want to run it off of the main thread.
65+
For instance, you use a future when you need to call an algorithm that runs an indeterminate amount of time---such as calling a remote microservice---so you want to run it off of the main thread.
6666

6767
To demonstrate how this works, let’s start with a `Future` example in the REPL.
6868
First, paste in these required `import` statements:
@@ -252,7 +252,7 @@ Then, at 806 ms, the three futures complete and the code in the `yield` block is
252252
Then the code immediately goes to the `Success` case in the `onComplete` method.
253253

254254
The 806 ms output is a key to seeing that the three futures are run in parallel.
255-
If they were run sequentially, the total time would be about 1,400 ms --- the sum of the sleep times of the three futures.
255+
If they were run sequentially, the total time would be about 1,400 ms---the sum of the sleep times of the three futures.
256256
But because they’re run in parallel, the total time is just slightly longer than the longest-running future: `f1`, which is 800 ms.
257257

258258

Diff for: _overviews/scala3-book/control-structures.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ This is how the expression works:
284284

285285
1. The `for` expression starts to iterate over the values in the range `(10, 11, 12)`.
286286
It first works on the value `10`, multiplies it by `2`, then _yields_ that result, the value `20`.
287-
2. Next, it works on the `11` --- the second value in the range.
287+
2. Next, it works on the `11`---the second value in the range.
288288
It multiples it by `2`, then yields the value `22`.
289289
You can think of these yielded values as accumulating in a temporary holding place.
290290
3. Finally the loop gets the number `12` from the range, multiplies it by `2`, yielding the number `24`.
@@ -443,7 +443,7 @@ i match
443443

444444
#### Case classes and match expressions
445445

446-
You can also extract fields from `case` classes --- and classes that have properly written `apply`/`unapply` methods --- and use those in your guard conditions.
446+
You can also extract fields from `case` classes---and classes that have properly written `apply`/`unapply` methods---and use those in your guard conditions.
447447
Here’s an example using a simple `Person` case class:
448448

449449
```scala
@@ -470,7 +470,7 @@ def isTruthy(a: Matchable) = a match
470470
case _ => true
471471
```
472472

473-
The input parameter `a` is defined to be the [`Matchable` type][matchable] --- which is the root of all Scala types that pattern matching can be performed on.
473+
The input parameter `a` is defined to be the [`Matchable` type][matchable]---which is the root of all Scala types that pattern matching can be performed on.
474474
The method is implemented by matching on the input, providing two cases:
475475
The first one checks whether the given value is either the integer `0` or an empty string and returns `false` in this case.
476476
In the default case, we return `true` for any other value.

Diff for: _overviews/scala3-book/domain-modeling-fp.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ case class Order(
133133
#### “Skinny domain objects”
134134

135135
In his book, *Functional and Reactive Domain Modeling*, Debasish Ghosh states that where OOP practitioners describe their classes as “rich domain models” that encapsulate data and behaviors, FP data models can be thought of as “skinny domain objects.”
136-
This is because --- as this lesson shows --- the data models are defined as `case` classes with attributes, but no behaviors, resulting in short and concise data structures.
136+
This is because---as this lesson shows---the data models are defined as `case` classes with attributes, but no behaviors, resulting in short and concise data structures.
137137

138138

139139

@@ -221,7 +221,7 @@ These different solutions are shown in the remainder of this section.
221221

222222
### Companion Object
223223

224-
A first approach is to define the behavior --- the functions --- in a companion object.
224+
A first approach is to define the behavior---the functions---in a companion object.
225225

226226
> As discussed in the Domain Modeling [Tools section][modeling-tools], a _companion object_ is an `object` that has the same name as a class, and is declared in the same file as the class.
227227
@@ -292,7 +292,7 @@ trait PizzaServiceInterface:
292292
def updateCrustType(p: Pizza, ct: CrustType): Pizza
293293
```
294294

295-
As shown, each method takes a `Pizza` as an input parameter --- along with other parameters --- and then returns a `Pizza` instance as a result
295+
As shown, each method takes a `Pizza` as an input parameter---along with other parameters---and then returns a `Pizza` instance as a result
296296

297297
When you write a pure interface like this, you can think of it as a contract that states, “all non-abstract classes that extend this trait *must* provide an implementation of these services.”
298298

@@ -309,7 +309,7 @@ val p3 = updateCrustType(p2, Thick)
309309
val p4 = updateCrustSize(p3, Large)
310310
```
311311

312-
If that code seems okay, you’ll typically start sketching another API --- such as an API for orders --- but since we’re only looking at pizzas right now, we’ll stop thinking about interfaces and create a concrete implementation of this interface.
312+
If that code seems okay, you’ll typically start sketching another API---such as an API for orders---but since we’re only looking at pizzas right now, we’ll stop thinking about interfaces and create a concrete implementation of this interface.
313313

314314
> Notice that this is usually a two-step process.
315315
> In the first step, you sketch the contract of your API as an *interface*.

Diff for: _overviews/scala3-book/domain-modeling-tools.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Person:
5252
defining the two fields `name` and `vocation` together with a constructor that accepts values for the two fields and assigns them.
5353

5454
All of the parameters of our example classes are defined as `var` fields, which means they are mutable: you can read them, and also modify them.
55-
If you want them to be immutable --- read only --- create them as `val` fields instead.
55+
If you want them to be immutable---read only---create them as `val` fields instead.
5656

5757
Prior to Scala 3, you used the `new` keyword to create a new instance of a class:
5858

@@ -297,7 +297,7 @@ Companion objects can be used for several purposes:
297297
- As shown, they can be used to group “static” methods under a namespace
298298
- These methods can be public or private
299299
- If `calculateArea` was public, it would be accessed as `Circle.calculateArea`
300-
- They can contain `apply` methods, which --- thanks to some syntactic sugar --- work as factory methods to construct new instances
300+
- They can contain `apply` methods, which---thanks to some syntactic sugar---work as factory methods to construct new instances
301301
- They can contain `unapply` methods, which are used to deconstruct objects, such as with pattern matching
302302

303303
Here’s a quick look at how `apply` methods that can be used as factory methods to create new objects:
@@ -352,7 +352,7 @@ trait Employee:
352352
def lastName: String
353353
```
354354
However, traits can also contain concrete members.
355-
For instance, the following trait defines two abstract members --- `numLegs` and `walk()` --- and also has a concrete implementation of a `stop()` method:
355+
For instance, the following trait defines two abstract members---`numLegs` and `walk()`---and also has a concrete implementation of a `stop()` method:
356356

357357
```scala
358358
trait HasLegs:
@@ -514,7 +514,7 @@ enum Color extends Enum[Color] { case Red, Green, Blue }
514514
```
515515

516516
The type parameter comes from the Java `enum` definition, and should be the same as the type of the enum.
517-
There’s no need to provide constructor arguments (as defined in the Java API docs) to `java.lang.Enum` when extending it --- the compiler generates them automatically.
517+
There’s no need to provide constructor arguments (as defined in the Java API docs) to `java.lang.Enum` when extending it---the compiler generates them automatically.
518518

519519
After defining `Color` like that, you can use it like you would a Java enum:
520520

@@ -603,7 +603,7 @@ case class Student(name: String, year: Int) extends Person
603603
case class Teacher(name: String, specialty: String) extends Person
604604
```
605605

606-
Because those are defined as case classes --- and they have built-in `unapply` methods --- you can write a match expression like this:
606+
Because those are defined as case classes---and they have built-in `unapply` methods---you can write a match expression like this:
607607

608608
```scala
609609
def getPrintableString(p: Person): String = p match

Diff for: _overviews/scala3-book/first-look-at-types.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ val d: Double = 2.0
8787
val f: Float = 3.0
8888
```
8989

90-
In the first four examples, if you don’t explicitly specify a type, the number `1` will default to an `Int`, so if you want one of the other data types --- `Byte`, `Long`, or `Short` --- you need to explicitly declare those types, as shown.
90+
In the first four examples, if you don’t explicitly specify a type, the number `1` will default to an `Int`, so if you want one of the other data types---`Byte`, `Long`, or `Short`---you need to explicitly declare those types, as shown.
9191
Numbers with a decimal (like 2.0) will default to a `Double`, so if you want a `Float` you need to declare a `Float`, as shown in the last example.
9292

9393
Because `Int` and `Double` are the default numeric types, you typically create them without explicitly declaring the data type:
@@ -112,7 +112,7 @@ val s = "Bill"
112112
val c = 'a'
113113
```
114114

115-
As shown, enclose strings in double-quotes --- or triple-quotes for multiline strings --- and enclose a character in single-quotes.
115+
As shown, enclose strings in double-quotes---or triple-quotes for multiline strings---and enclose a character in single-quotes.
116116

117117
Those data types and their ranges are:
118118

@@ -263,7 +263,7 @@ This will be covered later in the tour.
263263

264264
`Nothing` is a subtype of all types, also called the **bottom type**.
265265
There is no value that has the type `Nothing`.
266-
A common use is to signal non-termination, such as a thrown exception, program exit, or an infinite loop --- i.e., it is the type of an expression which does not evaluate to a value, or a method that does not return normally.
266+
A common use is to signal non-termination, such as a thrown exception, program exit, or an infinite loop---i.e., it is the type of an expression which does not evaluate to a value, or a method that does not return normally.
267267

268268
`Null` is a subtype of all reference types (i.e. any subtype of `AnyRef`).
269269
It has a single value identified by the keyword literal `null`.

Diff for: _overviews/scala3-book/fp-functional-error-handling.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ In this example, if `x` can be converted to an `Int`, the first `case` statement
117117

118118
## Using a `for` expression
119119

120-
Another common solution is to use a `for` expression --- i.e., the `for`/`yield` combination that was shown earlier in this book.
120+
Another common solution is to use a `for` expression---i.e., the `for`/`yield` combination that was shown earlier in this book.
121121
For instance, imagine that you want to convert three strings to integer values, and then add them together.
122122
This is how you do that with a `for` expression and `makeInt`:
123123

@@ -267,7 +267,7 @@ val santa = new Address(
267267
```
268268

269269
Historically, developers have used blank strings and null values in this situation, both of which are hacks to work around the root problem: `street2` is an *optional* field.
270-
In Scala --- and other modern languages --- the correct solution is to declare up front that `street2` is optional:
270+
In Scala---and other modern languages---the correct solution is to declare up front that `street2` is optional:
271271

272272
```scala
273273
class Address:

Diff for: _overviews/scala3-book/fp-functions-are-values.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ In most scenarios it doesn’t matter if `double` is a function or a method; Sca
7474
Behind the scenes, the Scala technology that lets you treat methods just like functions is known as [Eta Expansion][eta].
7575

7676
This ability to seamlessly pass functions around as variables is a distinguishing feature of functional programming languages like Scala.
77-
And as you’ve seen in the `map` and `filter` examples throughout this book, the ability to pass functions into other functions helps you create code that is concise and still readable --- *expressive*.
77+
And as you’ve seen in the `map` and `filter` examples throughout this book, the ability to pass functions into other functions helps you create code that is concise and still readable---*expressive*.
7878

7979
If you’re not comfortable with the process of passing functions as parameters into other functions, here are a few more examples you can experiment with:
8080

Diff for: _overviews/scala3-book/fp-immutable-values.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This is where higher-order functions like `map` and `filter` come in.
2323
TODO: need a better example
2424
{% endcomment %}
2525

26-
For example, imagine that you have a list of names --- a `List[String]` --- that are all in lowercase, and you want to find all the names that begin with the letter `"j"`, and then you want to capitalize those names.
26+
For example, imagine that you have a list of names---a `List[String]`---that are all in lowercase, and you want to find all the names that begin with the letter `"j"`, and then you want to capitalize those names.
2727
In FP you write this code:
2828

2929
```scala

Diff for: _overviews/scala3-book/fp-intro.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ next-page: fp-what-is-fp
88
---
99

1010

11-
Scala lets you write code in an object-oriented programming (OOP) style, a functional programming (FP) style, and also in a hybrid style --- using both approaches in combination.
11+
Scala lets you write code in an object-oriented programming (OOP) style, a functional programming (FP) style, and also in a hybrid style---using both approaches in combination.
1212
[As Martin Odersky has stated](https://twitter.com/alexelcu/status/996408359514525696), the essence of Scala is a fusion of functional and object-oriented programming in a typed setting:
1313

1414
- Functions for the logic

Diff for: _overviews/scala3-book/fp-pure-functions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ If you understand that code, you’ll see that it meets the pure function defini
112112
The first key point of this section is the definition of a pure function:
113113

114114
> A *pure function* is a function that depends only on its declared inputs and its internal algorithm to produce its output.
115-
> It does not read any other values from “the outside world” --- the world outside of the function’s scope --- and it doesn’t modify any values in the outside world.
115+
> It does not read any other values from “the outside world”---the world outside of the function’s scope---and it doesn’t modify any values in the outside world.
116116
117117
A second key point is that every real-world application interacts with the outside world.
118118
Therefore, a simplified way to think about functional programs is that they consist of a core of pure functions that are wrapped with other functions that interact with the outside world.

0 commit comments

Comments
 (0)