1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 04:41:47 +03:00

Define a merge method in Mergeable which generalizes sequenceAlt.

This commit is contained in:
Rob Rix 2016-07-22 17:51:57 -04:00
parent 8f8bf5dad9
commit afd67dbbd9

View File

@ -8,6 +8,10 @@ import Prologue
-- Classes
class Functor t => Mergeable t where
merge :: Alternative f => (a -> f b) -> t a -> f (t b)
default merge :: (Generic1 t, GMergeable (Rep1 t), Alternative f) => (a -> f b) -> t a -> f (t b)
merge = genericMerge
sequenceAlt :: Alternative f => t (f a) -> f (t a)
default sequenceAlt :: (Generic1 t, GMergeable (Rep1 t), Alternative f) => t (f a) -> f (t a)
sequenceAlt = genericSequenceAlt