Given:
data Foo =
FooString String
…
class Fooable a where --(is this a good way to name this?)
toFoo :: a -> Foo
<
You're running into two limitations of classic Haskell98 typeclasses:
These onerous restrictions are lifted by two language extensions:
-XTypeSynonymInstanceswhich allows you to use type synoyms (like String for [Char]), and:
-XFlexibleInstanceswhich lift the restrictions on instance types being of the form T a b .. where the parameters are type variables. The -XFlexibleInstances flag allows the head of the instance declaration to mention arbitrary nested types.
Note that lifting these restrictions can sometimes lead to overlapping instances, at which point, an additional language extension might be needed to resolve the ambiguity, allowing GHC to pick an instance for you.
References::