[Haskell-cafe] type/class question: toString

David Benbennick dbenbenn at gmail.com
Tue Nov 6 12:15:39 EST 2007


On 11/6/07, Graham Fawcett <graham.fawcett at gmail.com> wrote:
> ToString.hs:5:0:
>     Illegal instance declaration for `MyShow String'
>         (The instance type must be of form (T a b c)
>          where T is not a synonym, and a,b,c are distinct type variables)
>     In the instance declaration for `MyShow String'
>
> ToString.hs:6:0:
>     Illegal instance declaration for `MyShow a'
>         (The instance type must be of form (T a b c)
>          where T is not a synonym, and a,b,c are distinct type variables)
>     In the instance declaration for `MyShow a'

In ghc 6.8.1, the error messages are more helpful:

foo.hs:5:0:
    Illegal instance declaration for `MyShow String'
        (All instance types must be of the form (T t1 ... tn)
         where T is not a synonym.
         Use -XTypeSynonymInstances if you want to disable this.)
    In the instance declaration for `MyShow String'

foo.hs:6:0:
    Illegal instance declaration for `MyShow a'
        (All instance types must be of the form (T a1 ... an)
         where a1 ... an are distinct type *variables*
         Use -XFlexibleInstances if you want to disable this.)
    In the instance declaration for `MyShow a'

When I run with -XTypeSynonymInstances -XFlexibleInstances it works.


More information about the Haskell-Cafe mailing list