[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Recursive type synonyms
Stefan Kahrs makes a very good point! Thanks, Stefan.
I still think recursive type synonyms, restricted so as to be
equivalent to mu types, are a good idea. But they are less
appealing than before: rather than eliminate a restriction, we
have simply introduced a new restriction (though a less restrictive
So perhaps this is a matter for Haskell 2 rather than Haskell 1.3.
Still, I hope someone will experiment with the idea!
From firstname.lastname@example.org Thu Oct 7 16:32:12 1993
Subject: Re: Recursive type synonyms
Date: Thu, 7 Oct 93 16:19:00 BST
Phil Wadler wrote:
> Mark suggests that Mu types might be better that recursive type
> synonyms. I think of them as pretty much equivalent, and it's
> simply a question of whether one makes the `mu' syntax accessible
> to the user. One certainly needs `mu' or an equivalent internally
> for doing the typechecking. The advantage of the way I put it
> is that it makes for a minimal change from the current language:
> just get rid of one restriction. -- P
They are not quite equivalent:
The difference between mu-types and recursive type synonyms is the
difference between decidable and undecidable type inference.
The problem is that type synonyms are parametric and one could write
type synonyms in which the recursive occurrence of the type identifier
is used with a non-type-variable argument, e.g.
type Rec a = Rec (a->a)
Type synonyms like this are not expressible with mu-types.