mirror of
https://github.com/github/semantic.git
synced 2024-12-19 12:51:52 +03:00
Define a genericMerge helper.
This commit is contained in:
parent
1d7645cafe
commit
8f8bf5dad9
@ -9,6 +9,9 @@ import Prologue
|
||||
class GMergeable t where
|
||||
gmerge :: Alternative f => (a -> f b) -> t a -> f (t b)
|
||||
|
||||
genericMerge :: (Generic1 t, GMergeable (Rep1 t), Alternative f) => (a -> f b) -> t a -> f (t b)
|
||||
genericMerge f = fmap to1 . gmerge f . from1
|
||||
|
||||
genericSequenceAlt :: (Generic1 t, GMergeable (Rep1 t), Alternative f) => t (f a) -> f (t a)
|
||||
genericSequenceAlt = fmap to1 . gmerge identity . from1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user