Haskell provides a standard typeclass 'Alternative' that effectively provides the <|> operator for any type that is also an Applicative.
As I understand it Alternative is considered a Monoid on Applicative's, however the <|> operator seems to make complete sense in a lot of types that aren't Applicative Functors as well, and there doesn't need to be any specific dependency on the Applicative typeclass for it to work properly.
Is there a reason why Alternative needs to be a subclass of Applicative, and if so is there a standard typeclass to define similar functionality on non-applicative types?
Monoidwould be the class for non-applicative types. - LeeMonoidis a class of types andAlternativeis a class of type constructors. I wish we could have locally quantified constraints on type constructors, such as(forall a. Monoid f a)but that's not allowed. - pigworker<|>operator is "Pick or ore another", which is somewhat different tomconcat? - James Davies