[Haskell-cafe] Type family signatures

Thomas van Noort thomas at cs.ru.nl
Mon Aug 17 03:12:21 EDT 2009


Somehow I didn't receive David's mail, but his explanation makes a lot 
of sense. I'm still wondering how this results in a type error involving 
rigid type variables.

Ryan Ingram wrote:
> 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
> _______________________________________________
> 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