[Haskell-cafe] Type family signatures

Ryan Ingram ryani.spam at gmail.com
Fri Aug 14 16:49:15 EDT 2009


On Fri, Aug 14, 2009 at 12:03 PM, Dan Weston<westondan at imageworks.com> wrote:
> But presumably he can use a data family instead of a type family to restore
> injectivity, at the cost of adding an extra wrapped bottom value and one
> more layer of value constructor?

Actually, you don't even necessarily pay this penalty, since you can
put newtypes into data families.

> data family Foo a
> newtype instance Foo () = UnitFoo Int

You do need to add the constructor wrap/unwrapping in code, but they
all get erased after typechecking.

  -- ryan


More information about the Haskell-Cafe mailing list