Monadic ScalaFX Demo
This is an experimental demo project in which I try to make use of the object functional nature of scala, it's expressive syntax, the actor model (Akka for now), ScalaFX DSL and pure functional programming concepts such as the IO monad to compose and create a lightweight, concurrent JavaFX GUI application.
Key aims of this demo -
- Use of IO monad, for now I'm using Monix's Task
- Pure, referentially transparent, lazy functions
- Avoiding global mutable state
- Reflection free JSON serialiation/deserialization(using Circe here)
- Compile time Dependency Injection (using Macwire in this case)
- Non blocking asynchronous I/O and green threading
- Lock free asynchronous mutable state synchronization using Actors or Monads such as Cats Ref or Monix Mvar
- Actors and green threads must run on the JavaFX Application Thread itself, to avoid nested Platform.runLater() callback hell. Such code must therefore be async and non blocking.
- Multiple thread pools are used depending on the nature of the computation. Currently there is one each for JavaFX application tasks, cpu bound or async blocking tasks, and blocking tasks.
- Make it possible to share code with Scala.js using cross compilation
While I've got the basic down, I do not have a lot of experience in monadic programming, so I must learn as I go. I would really appreciate any suggestions or advice.