Sergey, thanks for the bug reports
> data R = R {r :: Int}
> rr = R {r=-1}
> ...:4:10: Haskell 98 does not support 'punning' on records
> on input: "=-"
The error message is unhelpful, but indeed there is a parse error:
'=-' is a valid token in Haskell, different from '=' '-'.
> It reports
> panic! (the `impossible' happened):
> zonkTcTypeToType: free type variable with non-* type:
> c{-a144-}
Your program is not doing what you expected, and it turned out
to tickle a case whose comment said 'No one in their right mind
will do this, so I won't bother to handle it yet'. Well you caught
me out. I've written the code now.
But when you wrote
data Mix a = Mix [(Key, c a)]
GHC understood this as
data Mix a = Mix (forall c. [(Key, c a)])
which is 99.99% certainly not what you meant. For existentials you
have to write
data Mix a = forall c. Mix [(Key, c a)]
Even then, there is virtually nothing useful you can do with this.
Someone should write a tutorial on what you can do with existential.
Any volunteers?
Simon