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