Hello, There is a thread on comp.lang.functional that talks about why haskell does not support recursive types:
http://groups.google.com/groups?q=ocaml+rectypes&hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8&safe=off&selm=8giqpt%24oee%241%40rivesaltes.inria.fr&rnum=1 (searching for 'ocaml rectypes' on google groups turns up a number of useful threads about the joys and dangers of allowing recursive types). Jeremy Shaw. At Wed, 3 Dec 2003 14:07:03 -0800, Jeffrey A. Scofield <[EMAIL PROTECTED]> wrote: > > Greetings. > > Say I have the following function, adapted from Pierce, Types and > Programming languages: > > f n () = (n, f (n + 1)) > > Now, this function fails to typecheck in ghc 6.0.1 because the > subexpression f (n + 1) has the infinite type t = () -> (t1, t) > And so I assume (perhaps wrongly?) that f is ill-typed in Haskell 98. > > I have two questions: > > 1. How can I tell from the Haskell 98 Revised Report that this > function isn't allowed? The discussions of typing in the Report > generally defer to the ``standard Hindley-Milner analysis.'' > Is this really enough to tell that the function isn't well-typed > in Haskell? I concede that I haven't read the cited Hindley and > Damas/Milner papers, but it seems like there might be more to > say about what is and isn't allowed. > > 2. Is there by chance a compiler option for ghc that causes the > restriction to be dropped? > > I don't need this kind of function for anything practical (and I > realize I can get an equivalent effect with an algebraic datatype). > I'm just trying to figure out what typing restrictions (if any) are > implicitly assumed in the Report. (Generally, this is the kind of > stuff I don't know, as a relative newcomer to fp.) > > Regards, > > Jeff Scofield (PhD) > Seattle _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
