-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,4 +130,3 @@ I thought I knew Scala... | |
- circe | ||
- shapeless | ||
- kafka streams processing | ||
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package fwd | ||
|
||
object ForwardReferenceProblem extends App { | ||
|
||
val x = y | ||
val y = 5 | ||
|
||
println(s"x=$x") | ||
println(s"y=$y") | ||
|
||
/** compilation fails 1: | ||
* | ||
* def noProblem1() = { | ||
* val a = b | ||
* val b = 1 | ||
* } | ||
* | ||
*/ | ||
|
||
/** compilation fails 1: | ||
* | ||
* def noProblem2() = for { | ||
* b <- Option(a) | ||
* a <- Option(1) | ||
* } yield (a, b) | ||
* | ||
*/ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package advanced | ||
|
||
object TypeLambda3 extends App { | ||
|
||
// Functor has one `hole` | ||
trait Functor[F[_]] | ||
|
||
// MonadError has two `holes` | ||
trait MonadError[F[_], E] | ||
|
||
// Functor can be specified as a type bounds | ||
class Repository1[F[_]: Functor] | ||
|
||
// but MonadError can not | ||
|
||
// we can introduce type alias | ||
type MonadErrorThrowable[F[_]] = MonadError[F, Throwable] | ||
|
||
// and use it | ||
class Repository2[F[_]: MonadErrorThrowable] | ||
|
||
// or use type lambda and not declare alias | ||
class Repository3[F[_]: ({ type MET[f[_]] = MonadError[f, Throwable] })#MET] | ||
|
||
// or use type lambda and not declare alias | ||
class Repository4[F[_]: MonadError[*[_], Throwable]] | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
### repositories | ||
|
||
- https://github.com/alexr007/learning-scalajs2.git | ||
- https://github.com/alexr007/learning-scalajs3.git | ||
- https://github.com/alexr007/learning-fullstack.git | ||
- https://github.com/alexr007/learning-doodle.git | ||
- https://github.com/alexr007/learning-chartreuse.git | ||
- https://github.com/alexr007/learning-chartreuse.git | ||
- https://github.com/alexr007/learning-tyrian.git | ||
- https://github.com/alexr007/learning-haskell.git | ||
- https://github.com/alexr007/learning-rust.git | ||
- |