I've been playing around with "The Little MLer" (pg. 95, 96) to try to improve 
my understanding of types.

I can ask ML:
 
- ints(0);
val it = Link (1,fn) : chain
-

and Haskell:

*Main> :t ints 0
ints 0 :: Chain
*Main> ints 0

<interactive>:1:0:
    No instance for (Show Chain)
      arising from a use of `print' at <interactive>:1:0-5
    Possible fix: add an instance declaration for (Show Chain)
    In a stmt of a 'do' expression: print it
*Main> 

I think I need to write a show function for type Chain but not
sure how to proceed.

Michael

===============

;;ML

datatype chain =
  Link of (int * (int -> chain))

fun ints(n)
  = Link(n + 1, ints)

;;Haskell

data Chain = Link Int (Int -> Chain)

ints :: Int -> Chain
ints n = Link (n+1) ints




      
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to