Injective type families?

Sebastian Fischer fischer at nii.ac.jp
Tue Feb 15 02:00:25 CET 2011


>
> On Mon, Feb 14, 2011 at 1:41 PM, John Meacham <john at repetae.net> 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 conal.net> 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..

Sebastian

[1]:
http://unlines.wordpress.com/2010/11/15/generics-for-small-fixed-size-vectors/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20110215/ddc84238/attachment.htm>


More information about the Glasgow-haskell-users mailing list