✅ LanguageExt bind if
I'm having trouble understanding how to do something particular in LanguageExt that I think is just a part of functional programming in general. I have an effectful method, which I then want to evaluate the result of, and rerun if not meeting a condition. Originally, I did it like this
Turns out, obviously enough, it runs PollInput twice when you do this, which isn't good. Instead, I'm now trying to do something like this
But this doesn't work, since keyPressed is not an Eff, and PollValidInput (the method this is running in), is an Eff. I have no idea how to do this. I just want to bind that else condition when that match fails, but I need to bind/map to run that condition, so I also need to return something for when that condition is met.
Any ideas?
1 Reply
Figured it out