Injective type families?

Sebastian Fischer fischer at
Tue Feb 15 02:00:25 CET 2011

> On Mon, Feb 14, 2011 at 1:41 PM, John Meacham <john at> wrote:
>> Isn't this what data families (as opposed to type families) do?
On Tue, Feb 15, 2011 at 7:02 AM, Conal Elliott <conal at> wrote:

> Yes, it's one things that data families do. Another is introducing *new*
> data types rather than reusing existing ones. - Conal

Roman Leshchinskiy once used a newtype to make a type family injective and
remarked: "As an aside, it is well possible to [use] an injective data type
family or even a GADT [instead]. ... However, this really messes up GHC’s
optimiser and leads to very inefficient code." [1]

Of course, introducing a newtype also requires introducing new types instead
of reusing existing ones..


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Glasgow-haskell-users mailing list