[m-users.] IO and global state.

Julien Fischer jfischer at opturion.com
Mon Apr 26 19:41:17 AEST 2021



On Mon, 26 Apr 2021, Sean Charles (emacstheviking) wrote:

> Excellent then, I shall happily save my constant data into IO state
> and see how it goes.
> 
> I do have one error I cannot figure out yet… I attempted to re-code my
> ‘debug_on’ predicate to use IO instead of the Options and I get an
> error I cannot yet figure out ( again :| )…
> 
> The exports:
> 
> :- func debug_on(felt_options) = bool.
> :- func debug_on(io::di, io::uo) = bool. % LINE 28, see error message below.

The error is because you need to provide modes on *all* arguments, you
haven't put one on the return value, it should be:

     :- func debug_on(io::di, io::uo) = (bool::out) is det.

However, it would be much more usual to use a predicate for that:

     :- pred debug_on(bool::out, io::di, io::uo) is det.

Julien.


More information about the users mailing list