Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write a small but interesting self-contained example with simple monad #6

Closed
rssh opened this issue Jan 23, 2020 · 5 comments
Closed
Labels
good first issue Good for newcomers

Comments

@rssh
Copy link
Owner

rssh commented Jan 23, 2020

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.

@rssh rssh added the good first issue Good for newcomers label Jan 23, 2020
@aappddeevv
Copy link

Even a nice example just showing its use to some remote APIs would be nice!

@rssh
Copy link
Owner Author

rssh commented May 9, 2021

@latifbhatti
Copy link

I am interesting in this project please assign me task

@samadpls
Copy link

samadpls commented Mar 9, 2023

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.

@rssh
Copy link
Owner Author

rssh commented Mar 9, 2023

@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.

@rssh rssh closed this as completed Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants