Illegal type synonym family application in instance (Was: Breakage with 6.10)

David Menendez dave at zednenem.com
Fri Oct 10 21:53:03 EDT 2008


On Fri, Oct 10, 2008 at 8:40 PM, Niklas Broberg
<niklas.broberg at gmail.com> wrote:
> src\HSX\XMLGenerator.hs:71:0
>    Illegal type synonym family application in instance: XML m
>    In the instance declaration for `EmbedAsChild m (XML m)´
> ---------------
>
> Could someone help me point out the problem here? The relevant code is:
>
> instance XMLGen m => EmbedAsChild m (XML m) where
>  asChild = return . return . xmlToChild
>
> class XMLGen m => EmbedAsChild m c where
>  asChild :: c -> GenChildList m
>
> class Monad m => XMLGen m where
>  type XML m
>  ....
>
> This works fine with 6.8.3, so what's new in 6.10, and what would I do
> to solve it?

I'm guessing there was a bug in 6.8.3 that allowed this. (The
implementation of type families is present but not supported in 6.8,
presumably because of problems like this.)

I don't have 6.10, so I can't test anything, but you might try
rewriting the EmbedAsChild instances like so:

    instance (XMLGen m, XML m ~ x) => EmbedAsChild m x where ...

Alternatively, you can make separate instances for every type in the
range of XML.

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>


More information about the Glasgow-haskell-users mailing list