Re: [Haskell-cafe] Type families vs. functional dependencies -- how to express something

2010-05-24 Thread Ryan Ingram
I'm pretty sure this is a bug. My code works if I put a type signature on your second example. *TFInjectivity :t testX' testX' :: (P a ~ B (L a), X' a) = a - B (L a) *TFInjectivity :t testX' (\(A _) - B __) :: B (HCons a HNil) testX' (\(A _) - B __) :: B (HCons a HNil) :: B (HCons a HNil)

Re: [Haskell-cafe] Type families vs. functional dependencies -- how to express something

2010-05-21 Thread Tomáš Janoušek
Hello, On Tue, May 18, 2010 at 04:47:50PM -0700, Dan Weston wrote: Unifying those two types by hand, I get: P (A t - B a) ~ P (B a) Maybe the problem is that type families (and associated types, their class cousins) are not injective: P x ~ P y does not imply that x ~ y.

[Haskell-cafe] Type families vs. functional dependencies -- how to express something

2010-05-18 Thread Tomáš Janoušek
Hello all, for the past few hours I've been struggling to express a certain idea using type families and I really can't get it to typecheck. It all works fine using functional dependencies, but it could be more readable with TFs. From those papers about TFs I got this feeling that they should be

Re: [Haskell-cafe] Type families vs. functional dependencies -- how to express something

2010-05-18 Thread Dan Weston
Unifying those two types by hand, I get: P (A t - B a) ~ P (B a) Maybe the problem is that type families (and associated types, their class cousins) are not injective: P x ~ P y does not imply that x ~ y. Maybe you need a data type (with appropriate wrapping and unwrapping) to ensure