Re: [m-users.] Impurity needed?
Volker Wysk <[email protected]>
| Newsgroups | gmane.comp.lang.mercury.general |
|---|---|
| Message-ID | <[email protected]> |
Am Dienstag, dem 14.02.2023 um 01:05 +1100 schrieb Zoltan Somogyi:
> If you need an equivalent of Haskell's unsafe_perform_io, and it seems you do,
> you can build it yourself like this:
>
> promise_pure (
> some [!IO] (
> io.unsafe_get_io_state(!:IO),
> ...,
> io.unsafe_set_io_state(!.IO)
> )
> )
>
> unsafe_{get,set}_io are the primitives that the compiler uses
> to implement trace [io(!IO)]. We don't advertise them, since we want to
> discourage their use, but there is no point in hiding them either,
> because it is trivial to implement them using foreign_procs anyway.
This looks very interesting. I have to play with it. :-)
Volker
_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmPqW/QACgkQ+K4ydFOs HoXdIhAAjF9Avc8RUucVu5j/KKFjw8ndwK+V65QYw/njK6gnxN0DfGvZGIb06Pi4 y8BffPLZ1lsRBH+nCubGpx1S2oT2oXVw7ONy64LlgAL7oQV0tY7R4z2+ZEFr52lY orBkcj5auOQvS0nMcfoUKCu9PvevxQ3ab4mLU5IddbeWxOuNuiM7p7r6EtDF+U45 64Cww07ubbtOT/6TPW2g2Gh4gL62Wa9G8V5mLJoiWS46UD9lB+AkfNSIs0j38iX3 vAriPhsdV9cH+55TXstv4IhmR7s6cgIrx1VITC1fkg7c3T+t3u60RIEIqofHimGL pNMVES6KAiMMvjgcwGmiWeJqcztJfkljLjjmme4Oin8/Uq5anbkc4ATxYpx29A4K 9u1Ke3BzB9H0hTVNDcy4rScUshi2G5WYAeXQL8O5uiGh+4XqwB4ZdQPjwm3U0IIT Djq3m46CxMTEWvQp1mg7nwshCTM40+cjQxk6mT8efPsUvWocYEsh71ia5eNIWS// r5S/mk/RZF+FWcaoPKluvMoTedkdCpbqTm5dxaIjXdfA8+q5uB0AcPFwjto1TSZg TUcZUn0imZnvEpI6Ihsrh9e4O6GMIZuJcMbob6qJXaJdKD2/x/qh7so3pvWPguUo G5unkfFyX3GhyvFMta4t8R9L5yGrUYMT3TFGxB5J/zpZsU/09lE= =K7q8 -----END PGP SIGNATURE-----