<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thank you Zoltan and Peter then!<div class=""><br class=""></div><div class="">After a little more head scratching and using my go-to help tool, the mmc-doc sources, I have managed to work it out and I now have the following:</div><div class=""><br class=""></div><div class=""><font face="Menlo" style="font-size: 14px;" class=""> 64 :- type renderer == (pred(render_inst, rop_error, tcon, tcon)).<br class=""> 65 :- mode renderer == (pred(in, out, in, out) is det).</font></div><div class=""><font face="Menlo" style="font-size: 14px;" class="">:</font></div><div class=""><font face="Menlo" style="font-size: 14px;" class="">106         Renderer = get_target_renderer(Target),</font></div><div class=""><font face="Menlo" style="font-size: 14px;" class="">:</font></div><div class=""><font face="Menlo" style="font-size: 14px;" class="">155 :- func get_target_renderer(string::in) = (renderer::out(renderer)).<br class="">156 :- inst renderer == (pred(in, out, in, out) is det).<br class="">157<br class="">158 get_target_renderer(T) = R :-<br class="">159     LCTarget = string.to_lower(T),<br class="">160     ( if LCTarget = "php" then<br class="">161         R = target_c.render<br class="">162     else<br class="">163         R = target_c.render<br class="">164     ).</font></div><div class=""><br class=""></div><div class="">And it all works beautifully, thank you both for your guidance and assitance. I am not 100% sure I totally understand what’s going on but using mmc-doc’s definition of:</div><div class=""><font face="Menlo" style="font-size: 14px;" class=""><br class=""></font></div><div class=""><font face="Menlo" style="font-size: 14px;" class="">:- type maybeio == (pred(maybe(string), io, io)).<br class="">:- inst maybeio == (pred(out, di, uo) is det).<br class="">:- func (maybeio::in(maybeio)) // (maybeio::in(maybeio))<br class="">    = (maybeio::out(maybeio)).</font></div><div class=""><br class=""></div><div class="">I managed to work it out and then referred back to section 4.1 on Modes and section 8 Higher-order programming for some closure on the matter, at leat for now. I will spend some more time on it later but The Boss she now insists I have to mow the lawn front and back. Meh.</div><div class=""><br class=""></div><div class="">Thanks as always,</div><div class="">Sean.</div><div class=""><br class=""></div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 2 Oct 2021, at 22:25, Zoltan Somogyi <<a href="mailto:zoltan.somogyi@runbox.com" class="">zoltan.somogyi@runbox.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class="">2021-10-03 07:11 GMT+11:00 "Sean Charles (emacstheviking)" <<a href="mailto:objitsu@gmail.com" class="">objitsu@gmail.com</a>>:<br class=""><blockquote type="cite" class="">:- func get_target_renderer(string::in) = (renderer::out).<br class=""></blockquote><br class="">This is mirror image of the bug Peter pointed out yesterday:<br class="">the result of this function should have mode "out(renderer)"<br class="">instead of just "out". Declaring the result to have mode "out"<br class="">also throws away the mode information about the higher order<br class="">result, so it is not surprising that you get mode errors when<br class="">that higher order mode information is needed but not present,<br class="">i.e. what you call Renderer.<br class=""><br class="">Zoltan.</div></div></blockquote></div><br class=""></div></body></html>