Re: [m-users.] GitHub release "aio" -- ANSI I/O support.

Volker Wysk <[email protected]> Sat, 24 Aug 2024 14:27:43 +0200
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
Hi, Sean!

This is from your ANSI module:

:- type aio_state
    --->    aio_state(
                f_colour :: bool,    % Colour or monochrome output?
                f_quiet  :: bool     % All output suppressed?
            ).

:- mutable(astate, aio_state, aio_state(yes, no), ground, [untrailed]).

% ...

:- pragma promise_pure(enable_colours/1).

enable_colours(Mode) :-
    semipure get_astate(aio_state(_, Quiet)),
    impure set_astate(aio_state(Mode, Quiet)).


I'm wondering why you aren't using "attach_to_io_state" and don't make
enable_colours an IO action. You're using the impure get_astate/set_astate
instead. I don't fully comprehend the implications, but this should probably
be avoided.

Cheers,
Volker


Am Samstag, dem 24.08.2024 um 10:38 +0100 schrieb Sean Charles
(emacstheviking):
> I finally made it a library and decided to share it.
> It's probably not 100% efficient but then neither am I, but it works and
> does what I need.
> 
> 
> mercury-libaio.pngemacstheviking/mercury-libaio: Simple ANSI support for
> terminal based
> applications.
> github.com
> 
> 
> 
> Thanks,
> Sean.
> 
> _______________________________________________
> users mailing list
> [email protected]
> https://lists.mercurylang.org/listinfo/users

_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
mercury-libaio.png (image/png, 127.7 KB) - not displayed