-module(fp2@chain_rec). -compile(no_auto_import). -export([tail_rec/2]). -spec tail_rec(ELC, fun((ELC) -> {ok, ELD} | {error, ELC})) -> ELD. tail_rec(Start_with, F) -> Ab = F(Start_with), case Ab of {error, E} -> tail_rec(E, F); {ok, B} -> B end.