There is a function until in PureScript that is the closest to what I'm looking for: until :: ( a -> Boolean ) -> m a -> m a, but m is Monad, and I don't quite get yet how I can put a list of functions in it so that they will all get the same input value and be run one by one and tested after each run. until then returns a m a that is also can just be a list of results, kind of like map would produce, but that list will end as soon as (a -> Boolean) evaluates to true. Then I could just last on that m a result and, according to last definition, -> maybe get a successful output from the first succeeded function in the list =)
Cofounded Host Collective (DiscountASP.net). Cofounded Player Axis (Social Gaming). Computer Scientist and Technology Evangelist with 20+ years of experience with JavaScript!
There is a function
untilin PureScript that is the closest to what I'm looking for:until :: ( a -> Boolean ) -> m a -> m a, butmisMonad, and I don't quite get yet how I can put a list of functions in it so that they will all get the same input value and be run one by one and tested after each run.untilthen returns am athat is also can just be a list of results, kind of likemapwould produce, but that list will end as soon as(a -> Boolean)evaluates totrue. Then I could justlaston thatm aresult and, according tolastdefinition, -> maybe get a successful output from the first succeeded function in the list =)I think I found a somewhat simple solution!
Ahh okay. I see what you are trying to do. Nice solution!