[Haskell-cafe] Flexible instances

Luke Palmer lrpalmer at gmail.com
Tue Oct 14 22:37:28 EDT 2008

On Tue, Oct 14, 2008 at 8:20 PM, George Pollard <porges at porg.es> wrote:
>> Illegal instance declaration for `Stringable [Char]'
>>         (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 `Stringable [Char]'
> 'Blah' isn't a type variable, is it? Is my brain just not working right
> today?

If you're stuck, this is a fairly arbitrary limitation and is easily
generalized.  GHC, at least, implements the FlexibleInstances
extension.  Put

{-# LANGUAGE FlexibleInstances #-}

At the top of the file and that will be an acceptable instance.


More information about the Haskell-Cafe mailing list