[m-users.] Can I turn an impure function into a semi-det pure function

Charles Shuller charles.shuller at gmail.com
Sat Jun 27 06:24:43 AEST 2015

Hello all,

Is there an accepted technique, or techniques for converting an impure
function into a pure function in Mercury?   If so, can someone point me at
the relevant docs??

I know there is some cleverness with the io state variables, but I don't
recall reading anything about how to generalize the technique for use in
new code.

More specifically, I want to fetch something from a web-server.

If I understand things correctly, this is a very impure thing to do, since
the results don't really depend much on the parameters.  For instance, the
contend returned can change between requests.

But if this function is impure, then it seems my entire program must also
be impure, which I would really rather avoid.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20150626/327dbaac/attachment.html>

More information about the users mailing list