Infinite types

Jeff Scofield jeff at
Sat Dec 6 16:48:30 EST 2003

Alastair Reid wrote:

> > 1.  How can I tell from the Haskell 98 Revised Report that [a function
> >     with an infinite type]
> >     isn't allowed?  The discussions of typing in the Report
> >     generally defer to the ``standard Hindley-Milner analysis.''

> 1) The only way to write the recursive type you want
>    in Haskell is using type synonyms.
> 2) The section describing type synonyms (4.2.2) explicitly rules it out.

This really makes sense, but I had been interpreting 4.2.2 as
a limitation on type synonym declarations rather than on types

It says:

    Although recursive and mutually recursive datatypes are allowed,
    this is not so for type synonyms, unless an algebraic datatype

To my (untutored) eye, this looks like a limitation on what can appear
in a type synonym declaration, not a limit on what types can appear
in a program.

Is it a reliable mental model to assume that if there's no way to
declare a type in Haskell, the type itself isn't allowed in a program?

(Note that this can't be true in every case; according to 4.5.4,
the monomorphism restriction introduces types that can't be declared
in Haskell.)

Thanks very much for the response.


Jeff Scofield

More information about the Haskell-Cafe mailing list