TypeFamilies vs. FunctionalDependencies & type-level recursion

dm-list-haskell-prime at scs.stanford.edu dm-list-haskell-prime at scs.stanford.edu
Mon May 30 02:16:23 CEST 2011


At Sun, 29 May 2011 19:35:15 -0400,
Dan Doel wrote:
> 
> On Sun, May 29, 2011 at 6:45 PM, Ben Millwood <haskell at benmachine.co.uk> wrote:
> 1) Disallow the overlapping instance C Int Char, because it is
> incompatible with the C Int Int from the other module. This is what
> GHC 7 seems to do.

This seems like the only reasonable option given the meaning of
functional dependencies.

> Also, in an unrelated direction: there are conditions on type families
> that can allow some overlapping to be permitted. For instance, if you
> simply want a closed type function, like, taking the above as an
> example:
> 
>     type family F a :: * where
>       instance F Int = Char
>       instance F a   = a

Something like this would be good.  Though you'd need a corresponding
value-level mechanism.  Is this part of any pending proposal?  I don't
suppose there's any way to get GHC to accept such code?  I only found
one cryptic mention of "closed synonym families" under a speculative
ideas list for type functions.

David



More information about the Haskell-prime mailing list