Understanding Effect and async code interaction
Hi, so I'm feeling a little lost with how Effect is supposed to interact with async code.
I simplified the problem that I'm working on to this regular async/await code. Basically the idea is to have 2 consecutive CLI prompts, where both of them will keep on repeating until user inputs some valid string (here, one that is not empty)
Previously I worked with fp-ts and having these 2 awaitable calls caused issues as well
I tried to model this with the use of Effect and the idea is simple: pipe the initial string, validate it creating Option.Option<string>, if it's not okay then do a recursive call in the function and ask user for new input. Then get another string the same way, and afterwards operate on these 2 values.
I managed to make it work so that it works for one user's input, but when I'm trying to implement it for 2 consecutive prompts, the best I could do was either
a) having the prompts appear on the screen at the same time, causing errors
b) introducing async/await calls inside of the Effect but it seems that it doesn't want to work ok
I simplified the problem that I'm working on to this regular async/await code. Basically the idea is to have 2 consecutive CLI prompts, where both of them will keep on repeating until user inputs some valid string (here, one that is not empty)
Previously I worked with fp-ts and having these 2 awaitable calls caused issues as well
I tried to model this with the use of Effect and the idea is simple: pipe the initial string, validate it creating Option.Option<string>, if it's not okay then do a recursive call in the function and ask user for new input. Then get another string the same way, and afterwards operate on these 2 values.
I managed to make it work so that it works for one user's input, but when I'm trying to implement it for 2 consecutive prompts, the best I could do was either
a) having the prompts appear on the screen at the same time, causing errors
b) introducing async/await calls inside of the Effect but it seems that it doesn't want to work ok
