dotty-cps-async
dotty-cps-async copied to clipboard
write a small but interesting self-contained example with simple monad
use as monad Try[List[_]] (or just List) and implement some exploring space algorithms, such as 8 eight queens puzzle, or knight tour in the monad, to have an example, which will not compile, but will eventually be compiled after we will add more construct. This will make the game of enumerating all possible scala syntax trees not such boring ;)
Now - all language construct are implemented, so. task can be reformulated as: define CpsAsyncMonad for Try[List[_]] (or use existing CpsMonad for List). to write some space exploration algorithm in direct style.
Even a nice example just showing its use to some remote APIs would be nice!
first nontrivial example is in scala-gopher:https://github.com/rssh/scala-gopher/blob/master/shared/src/test/scala/gopher/monads/Queens.scala
I am interesting in this project please assign me task
hey @rssh , I wanted to give you an update on the task you assigned during our last meeting. As you suggested, I used the Try[List[_]] monad to implement some space exploration algorithms such as the Subset Sum problem. The code is available at this link: https://github.com/samadpls/scala-gopher/blob/patch-1/shared/src/test/scala/gopher/monads/Subset_Sum.
The code works by recursively exploring all possible subsets of a given set and checking if any of them add up to a given sum. If a subset is found that adds up to the sum, the function returns Success with the subset as a List[List[Int]]. If no subset is found, the function returns Success with an empty List[List[Int]]. If there is an error, the function returns Failure with an error message.
@samadpls But how is this related to the dotty-cps-async project? The idea of this task is to receive a nice example of the applicability of the direct style (i.e. using async/await) for some non-usual monad.