<div dir="ltr">Hi Michael,<div><br></div><div>Your definition of int2string is fine. For example, the code</div><div><br></div><div><div>fun int2string (i : int) : string = show i</div><div><br></div><div>val s = int2string 10</div></div><div><br></div><div>compiles without errors. I suspect the problem is in another part of your code. The error message suggests that you have an expression that produces a list where something else is expected. In my experience learning languages of the ML family, in situations like this, it helps to type-annotate arguments and results of functions. Eventually, it also helps to type-annotate expressions. For example</div><div><br></div><div><div>val h = 10</div><div>val t = []</div><div>val s = (h :: t) : int</div></div><div><br></div><div>Thanks to the type annotation ": int", the compiler will produce an error saying that there is a list int where an int is required:</div><div><br></div><div><div>Expression:  Basis.Cons [int] {1 = h, 2 = t}</div><div>  Have con:  list int</div><div>  Need con:  int</div><div>Incompatible constructors</div><div>Have:  list int</div><div>Need:  int</div></div><div><br></div><div>Regards,</div><div>Saulo</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 9, 2016 at 4:07 AM, Michael Rohs <span dir="ltr"><<a href="mailto:michael.rohs@hci.uni-hannover.de" target="_blank">michael.rohs@hci.uni-hannover.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I have a question to a very simple problem. How to convert an integer to a string?<br>
<br>
This does not work:<br>
<br>
fun int2string (i : int) : string = show i<br>
<br>
Error message:<br>
<br>
/.../test.ur:19:36: (to 19:40) Unification failure<br>
Expression:  show [<UNIF:H::Type>] _<br>
  Have con:  show (list <UNIF:H::Type>)<br>
  Need con:  <UNIF:I::Type> -> <UNIF:J::Type><br>
Incompatible constructors<br>
Have:  show (list <UNIF:H::Type>)<br>
Need:  <UNIF:I::Type> -> <UNIF:J::Type><br>
<br>
I couldn't find anything else like Int.toString or so.<br>
<br>
Thank you very much in advance!<br>
<br>
Best,<br>
Michael<br>
<br>
<br>
______________________________<wbr>_________________<br>
Ur mailing list<br>
<a href="mailto:Ur@impredicative.com">Ur@impredicative.com</a><br>
<a href="http://www.impredicative.com/cgi-bin/mailman/listinfo/ur" rel="noreferrer" target="_blank">http://www.impredicative.com/<wbr>cgi-bin/mailman/listinfo/ur</a><br>
</blockquote></div><br></div></div>