I have a function f :: a -> Maybe a that I want to feed into itself with some initial input until it returns Nothing.untilNothing :: (a -> Maybe a) -> a -> auntilNothing f x = case f x ofJust x' -> untilNothing f x'Nothing -> xIs there a better way to do this? I feel like there is something more general going on with Monads being fed into themselves, but maybe I'm wrong. Thoughts?
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell- cafe
Only members subscribed via the mailman list are allowed to post.