[Haskell-cafe] Associated data types
Lennart Augustsson
lennart at augustsson.net
Wed Dec 10 08:36:11 EST 2008
For an associated data type D, we know that the type function D is
injective, i.e., for different indicies given to D we'll get different
data types. This makes much more powerful reasoning possible in the
type checker. If associated data types are removed there has to be
some new mechanism to declare an associated type as injective, or the
type system will lose power.
-- Lennart
2008/12/10 Eyal Lotem <eyal.lotem at gmail.com>:
> If we have associated type synonyms, is there still reason to have
> associated data types?
>
> For example, we can replace:
>
> class C b where
> data D b
> ...
>
> instance C Int where
> data D Int = D | E
>
> with:
>
> class C b where
> type D b
> ...
>
> data DInt = D | E
> instance C Int where
> type D Int = DInt
>
>
> Or perhaps allow, for convenience, this form (which would desugar to the
> above):
>
> class C b where
> type D b
> ...
>
> instance C Int where
> data D Int = D | E
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
More information about the Haskell-Cafe
mailing list