<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">I've been playing around with "The Little MLer" (pg. 95, 96) to try to improve my understanding of types.<br><br>I can ask ML:<br> <br>- ints(0);<br>val it = Link (1,fn) : chain<br>-<br><br>and Haskell:<br><br>*Main> :t ints 0<br>ints 0 :: Chain<br>*Main> ints 0<br><br><interactive>:1:0:<br> No instance for (Show Chain)<br> arising from a use of `print' at <interactive>:1:0-5<br> Possible fix: add an instance declaration for (Show Chain)<br> In a stmt of a 'do' expression: print it<br>*Main> <br><br>I think I need to write a show function for type Chain but not<br>sure how to proceed.<br><br>Michael<br><br>===============<br><br>;;ML<br><br>datatype chain =<br> Link of (int * (int -> chain))<br><br>fun ints(n)<br> = Link(n + 1,
ints)<br><br>;;Haskell<br><br>data Chain = Link Int (Int -> Chain)<br><br>ints :: Int -> Chain<br>ints n = Link (n+1) ints<br><br></td></tr></table><br>