The problem is that Alternative
is for type constructors of kind * -> *
, so if you say
instance Alternative e => ....
then e
has to be a type constructor, not a type. So e
could be []
or Maybe
or something, but not Int
.
Alternative's operator is <|>
which has type Alternative e => e a -> e a -> e a
. This forces e
to take an argument to make a type, like Maybe
has to take an argument, eg Maybe Int
.
Use Monoid
instead of Alternative
, because it's a type class instead of a constructor class. It's operator mappend
has type Monoid e => e -> e -> e
which is what you want for combining errors.