relaxed instance rules spec (was: the MPTC Dilemma (please solve))

Jim Apple jbapple+haskell-prime at gmail.com
Wed Mar 8 08:09:40 EST 2006


On 3/7/06, Ben Rudiak-Gould <Benjamin.Rudiak-Gould at cl.cam.ac.uk> wrote:
# John Meacham wrote:
# # Polymorphic recursion allows the construction of infinite types if I
# # understand what you mean.
#
# No, that's different. An infinite type can't be written in (legal) Haskell.

Though GHC with existentials allows something infinite looking (and
not just because I named it "Inf" :-)):

> {-# OPTIONS -fglasgow-exts #-}

> data Zero = Zero
> data Succ n = Succ n

> -- Error: infinite type!
> -- x = Succ x

> data Inf = forall n . Inf n
> y = Inf (Succ y)

Jim


More information about the Haskell-prime mailing list