In particular, I am thinking of a function which involves conditionals changing the recursive behavior and multiple F-algebras.
halting_search :: int -> (a -> bool) -> (a -> a) -> a -> Maybe a
halting_search 0 f_test f_next_candidate candidate = Nothing
halting_search (S n) f_test f_next_candidate candidate = case (f_test candidate) of
true => Just candidate
false => halting_search n f_test f_next_candidate (f_next_candidate candidate)
Is this capable of being written just using the cata
operator? The reason I'm asking is because I want a functional language that is fairly expressive but not overly expressive, and it seems like one way to do that might be to not allow explicit recursion but make cata
a primitive function.