RE: TypeFamilies vs. FunctionalDependencies type-level recursion

2011-06-14 Thread Simon Peyton-Jones
There was an interesting thread on haskell-prime [1], about the relationship between functional dependencies and type families. This message is my attempt to summarise the conclusions of that thread. I'm copying other interested parties (eg Oleg, Dimitrios) [1]

Re: TypeFamilies vs. FunctionalDependencies type-level recursion

2011-06-14 Thread Andrea Vezzosi
On Tue, Jun 14, 2011 at 4:40 PM, Dan Doel dan.d...@gmail.com wrote: On Tue, Jun 14, 2011 at 5:36 AM, Simon Peyton-Jones simo...@microsoft.com wrote: There was an interesting thread on haskell-prime [1], about the relationship between functional dependencies and type families.  This message is

Re: TypeFamilies vs. FunctionalDependencies type-level recursion

2011-06-14 Thread dm-list-haskell-prime
At Tue, 14 Jun 2011 09:36:41 +, Simon Peyton-Jones wrote: 5. David wants a wiki page fixed. But which one? And how is it locked down? This page: http://hackage.haskell.org/trac/haskell-prime/wiki/FunctionalDependencies Currently under cons for FunctionalDependencies, it

Re: TypeFamilies vs. FunctionalDependencies type-level recursion

2011-06-14 Thread Dan Doel
On Tue, Jun 14, 2011 at 11:27 AM, Andrea Vezzosi sanzhi...@gmail.com wrote:    class C a b | a - b    instance C a R    instance C T U Are you sure that worked before? 80% The following still does anyhow:    data R    data T    data U    class C a b | a - b    instance TypeCast R b =

Re: TypeFamilies vs. FunctionalDependencies type-level recursion

2011-06-14 Thread dm-list-haskell-prime
At Tue, 14 Jun 2011 10:40:48 -0400, Dan Doel wrote: 1. As things stand in GHC you can do some things with functional dependencies that you can't do with type families. The archetypical example is type equality.  We cannot write        type family Eq a b :: *        type instance Eq k

Re: TypeFamilies vs. FunctionalDependencies type-level recursion

2011-06-14 Thread Dan Doel
Sorry about the double send, David. I forgot to switch to reply-all in the gmail interface. On Tue, Jun 14, 2011 at 11:49 AM, dm-list-haskell-pr...@scs.stanford.edu wrote: You absolutely still can use FunctionalDependencies to determine type equality in GHC 7.  For example, I just verified the

Re: TypeFamilies vs. FunctionalDependencies type-level recursion

2011-06-14 Thread dm-list-haskell-prime
At Tue, 14 Jun 2011 12:31:47 -0400, Dan Doel wrote: Sorry about the double send, David. I forgot to switch to reply-all in the gmail interface. Okay. I don't really write a lot of code like this, so maybe I missed the quirks. In that case, HList has been relying on broken behavior of

Re: TypeFamilies vs. FunctionalDependencies type-level recursion

2011-06-14 Thread Dan Doel
On Tue, Jun 14, 2011 at 1:19 PM, dm-list-haskell-pr...@scs.stanford.edu wrote: No, these are not equivalent.  The first one TypeEq a b c is just declaring an instance that works forall c.  The second is declaring multiple instances, which, if there were class methods, could have different

RE: TypeFamilies vs. FunctionalDependencies type-level recursion

2011-06-14 Thread Simon Peyton-Jones
| http://hackage.haskell.org/trac/haskell-prime/wiki/FunctionalDependencies | | Currently under cons for FunctionalDependencies, it says: | | AssociatedTypes seem to be more promising. | | I proposed the following fix: | | AssociatedTypes seem to be more promising, but