[m-users.] More optimization away

Volker Wysk post at volker-wysk.de
Wed Dec 20 18:02:10 AEDT 2023


Hi

I've made my predicate dependent on the IO state, in order to prevent it
from being optimized away. However, the IO state isn't used inside the
predicate. So will this be optimized away in a non-default semantics?

:- pred throw_db_error(odbc.result::in, io::di, io::uo) is det.

throw_db_error(Res, !IO) :-
    (
        Res = odbc.ok(_)
    ;
        Res = odbc.error(Messages),
        throw(db_error(errors(Messages)))
    ).

TIA,
Volker


More information about the users mailing list