diff --git a/2024-10-art-of-scala/resources/cool-flork-meme-vector-illustration_622487-2016.avif b/2024-10-art-of-scala/resources/cool-flork-meme-vector-illustration_622487-2016.avif new file mode 100644 index 0000000..908f4eb Binary files /dev/null and b/2024-10-art-of-scala/resources/cool-flork-meme-vector-illustration_622487-2016.avif differ diff --git a/2024-10-art-of-scala/slides.html b/2024-10-art-of-scala/slides.html index b9dd791..58551d7 100644 --- a/2024-10-art-of-scala/slides.html +++ b/2024-10-art-of-scala/slides.html @@ -301,7 +301,7 @@

Higher-Kinded
Data

# Cool? -[TODO some funny pic] + ---- @@ -401,8 +401,6 @@

Higher-Kinded
Data

### Rule conditions -
Input[[t] =>> Expr[t => Boolean]]
- ```scala [1-4|5-8|10] object IsPositive extends Expr[Int => Boolean] { def evaluate: Int => Boolean = _ > 0 @@ -421,6 +419,8 @@

Higher-Kinded
Data

### Decision Input +Values passed during evaluation +
Input[[t] =>> t]
```scala [3|4|6] @@ -556,7 +556,9 @@

Higher-Kinded
Data

```scala def pure[A[_]](f: [t] => () => A[t]): Data[A] ``` -```scala [4-6] +
+ +```scala [|4-6] object Rule { def default[Input[_[_]]: HKD, Output[_[_]]: HKD](output: Output[OutputValue]): Rule[Input, Output] = { Rule( @@ -569,6 +571,8 @@

Higher-Kinded
Data

} ``` +
+ ++++ @@ -580,7 +584,9 @@

Higher-Kinded
Data

def mapK[B[_]](f: [t] => A[t] => B[t]): Data[B] } ``` -```scala [3,6] +
+ +```scala [|3|6] class Rule[..., Output[_[_]]: HKD](...) { def evaluateOutput(): Output[Value] = { output.mapK([t] => expr => expr.evaluate) @@ -591,6 +597,8 @@

Higher-Kinded
Data

} ``` +
+ ++++ @@ -598,7 +606,7 @@

Higher-Kinded
Data

### `HKD.map2` Merge two objects field by field -```scala +```scala [|2,3|5] def map2[A[_], B[_], C[_]]( dataA: Data[A], dataB: Data[B] @@ -606,18 +614,19 @@

Higher-Kinded
Data

f: [t] => (A[t], B[t]) => C[t], ): Data[C] ``` -```scala [3-6] +
+ +```scala [2|3-6] class Rule[..., Output[_[_]]: HKD](...) { - def evaluate(in: Input[Value]) = { - val evaluated: Input[Const[Boolean]] = - HKD.map2(matching, in)( - [t] => (expr, value) => expr.evaluate(value) - ) - ... - } + def evaluate(in: Input[Value]): Input[Const[Boolean]] = + HKD.map2(matching, in)( + [t] => (expr, value) => expr.evaluate(value) + ) } ``` +
+ ++++ @@ -754,7 +763,7 @@

Higher-Kinded
Data

```scala // Scala 3 -val foo: Context ?=> Int => [A] +val foo: Context ?=> Int => String // Scala 2 def foo(implicit ctx: Context): Int