I feel like this should be really easy, but i am stuck at this point for quite some time.
Is it possible in haskell to create an instance of a type class for a list of certain data types?
What i want to achieve is the following.
class Rename a where
findSub :: a -> a
-- A 'normal' instance would look like this
instance Rename Atom where
findSub ......
-- Now i want to acchieve something like this
instance Rename ([] Atom) where
findSub ......
How ever when i write this i get the following error:
* Illegal instance declaration for `Rename [Atom]'
(All instance types must be of the form (T a1 ... an)
where a1 ... an are *distinct type variables*,
and each type variable appears at most once in the instance head.
Use FlexibleInstances if you want to disable this.)
* In the instance declaration for `Rename ([] Atom)'
Failed, modules loaded: none.
I would like to know how to fix this and why this is not allowed.
Thanks in advance.