<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="">How do you convert a discriminated union to a printable string? I have this:<div class=""><br class=""></div><div class=""><font face="Courier" class="">    % Character classification types.<br class="">:- type char_type ---> ws; chr; op; cp; ol; cl; om; cm; sq; dq; tk.<br class="">:- type tokstate<br class="">        --->    skip_ws<br class="">        ;       eat_token.</font></div><div class=""><br class=""></div><div class="">Do I have to explicitly code a predicate for each type I define or not? In Haskell I can just add (show) to the definition and it does the write(!) thing. Can Mercury do that other than using io.print_line, sometimes I don’t want a new line!</div><div class=""><br class=""></div><div class="">Thanks</div><div class="">Sean</div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>