Skip to content

Commit 20ffbc5

Browse files
committed
Added adminition directive experiment.
1 parent cfda451 commit 20ffbc5

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

src/welcome/welcome.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ val newImprovedBjarne = originalBjarne.copy(favoriteLanguageId = scalaLanguage.i
139139

140140
<small>Try it in <a href="https://scastie.scala-lang.org/CKL6DnTRQyuXbKNS3kwsjQ"><img src="../img/media/welcome/scastie.png" alt="try it in scastie" width="10%" height="10%" style="vertical-align: middle;"></a></small>
141141

142-
> [!WARNING]
143-
> `case class` doesn’t guarantee deep immutability. Its fields are `val` by default, but those fields can still refer to mutable objects.
142+
@:warning
143+
`case class` doesn’t guarantee deep immutability. Its fields are `val` by default, but those fields can still refer to mutable objects.
144+
@:@
144145

145146
The important point is that operations on immutable values produce new values instead of changing existing ones. After calling `copy`, both `originalBjarne` and `newImprovedBjarne` remain available, and each retains its own value.
146147

@@ -527,8 +528,9 @@ final case class NotYet(thunk: () => Unit) {
527528
}
528529
```
529530

530-
> [!NOTE]
531-
> If you are familiar with void in other languages, Scala’s `Unit` serves a similar purpose: it indicates that a computation does not produce a meaningful result. Unlike `void`, `Unit` is a real type with exactly one value, `()`.
531+
@:note
532+
If you are familiar with void in other languages, Scala’s `Unit` serves a similar purpose: it indicates that a computation does not produce a meaningful result. Unlike `void`, `Unit` is a real type with exactly one value, `()`.
533+
@:@
532534

533535
When you create it, nothing runs; you have contained the side effect.
534536

@@ -947,8 +949,9 @@ object NotYet {
947949
}
948950
```
949951

950-
> [!NOTE]
951-
> The `=>` marks value as a by-name parameter. It lets us give delay some code to run later without wrapping that code in `() =>`. The `delay` method takes care of wrapping it in a `thunk` for us.
952+
@:note
953+
The `=>` marks value as a by-name parameter. It lets us give delay some code to run later without wrapping that code in `() =>`. The `delay` method takes care of wrapping it in a `thunk` for us.
954+
@:@
952955

953956
Now that we have some helpers with constructors, `flatMap`, `map`, and a `println`, we can simplify how we do everything. Here is `rollDice`
954957

@@ -1166,8 +1169,9 @@ val result: (Int, Int) = (3, 4)
11661169

11671170
Cheers all around! We just loosely reinvented the basic shape of `IO`, a foundational type from Cats Effect. `IO` lets us build and combine work such as printing and generating random numbers without doing that work immediately. *We decide* when the complete program is finally run.
11681171

1169-
> [!NOTE]
1170-
> This `IO` is a teaching model. Cats Effect’s `IO` provides stack-safe composition, cancellation, concurrency, resource-safety tools, and many other capabilities. Our version is intended only to demonstrate how effectful programs can be represented as data and interpreted later.
1172+
@:note
1173+
This `IO` is a teaching model. Cats Effect’s `IO` provides stack-safe composition, cancellation, concurrency, resource-safety tools, and many other capabilities. Our version is intended only to demonstrate how effectful programs can be represented as data and interpreted later.
1174+
@:@
11711175

11721176
You now know everything. Go forth, and program! But wait! A few more things.
11731177

0 commit comments

Comments
 (0)