[m-users.] IO and global state.

Sean Charles (emacstheviking) objitsu at gmail.com
Mon Apr 26 19:43:46 AEST 2021


I did use a predicate in the end, exactly as you stated, then but not for any other reason than it was the only way I could make it work!

Thanks for your time Julien, I am reading lots of your code now to cut down my mail moaning!
it’s not really moaning, it’s actually a heck of a lot of fun really.

Thanks all.
Sean


> On 26 Apr 2021, at 10:41, Julien Fischer <jfischer at opturion.com> wrote:
> 
> 
> 
> 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