[Haskell-cafe] Re: Are type synonym families really equivalent to fundeps?

Manuel M T Chakravarty chak at cse.unsw.edu.au
Tue Sep 4 01:06:59 EDT 2007

Chris Smith wrote,
> ChrisK wrote:
>> -- You need to help GHC more here:
>> type instance A_T () = <explicit type you actually use with ()>
>> type instance A_T (Var x) = <explicit type you actually use with (Var x)>
>> type instance A_T [t] = t
>> type instance A_T (RHS (Var x) a) = <explicit type you actually use ...>
>> type instance A_T (RHS [t] a) = t
> Chris, this actually isn't workable.  The problem is that there is no 
> such thing as "explicit type you actually ue with ()".  If the type 
> variable 'a' gets matched to () or (Var x), then t can be any type.  
> That works currently.  I don't want to fix the type of 't', as this code 
> goes in a library where different applications are using different types 
> for 't'.
> As I said, this is probably not really right, since () really doesn't 
> determine a value for a; but it does work right now.
> Just for kicks, I tried this:
>    type instance A_T () = forall t. t
> it didn't work.

Right-hand sides of type instances may not be polytypes.  There is a 
counter example in Section 7.2,


but the text didn't explicitly make that point.  I edited it to 
include that.


More information about the Haskell-Cafe mailing list