The Ap newtype wrapper provides a way of using an Applicative instance as a Monoid instance.
I think a similar thing can be done for Semialign and Align.
newtype Al f a = Al { getAl :: f a }
instance (Semialign f, Semigroup a) => Semigroup (Al f a) where
Al a <> Al b = Al (salign a b)
instance (Align f, Semigroup a) => Monoid (Al f a) where
mempty = Al nil
The Monoid laws should follow from salign being associative and nil being an identity of salign.
I haven't looked at other type classes, but perhaps this admits instances for them too.
The
Apnewtype wrapper provides a way of using anApplicativeinstance as aMonoidinstance.I think a similar thing can be done for
SemialignandAlign.The
Monoidlaws should follow fromsalignbeing associative andnilbeing an identity ofsalign.I haven't looked at other type classes, but perhaps this admits instances for them too.