mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Simplify unzip
using the Applicative
instance.
This commit is contained in:
parent
fd150be38e
commit
de6696ce50
@ -44,7 +44,7 @@ snd = Prelude.snd . runBoth
|
|||||||
|
|
||||||
unzip :: [Both a] -> Both [a]
|
unzip :: [Both a] -> Both [a]
|
||||||
unzip = foldr pair (pure [])
|
unzip = foldr pair (pure [])
|
||||||
where pair (Join (a, b)) (Join (as, bs)) = Join (a : as, b : bs)
|
where pair head tail = (:) <$> head <*> tail
|
||||||
|
|
||||||
instance Monoid a => Monoid (Join (,) a) where
|
instance Monoid a => Monoid (Join (,) a) where
|
||||||
mempty = pure mempty
|
mempty = pure mempty
|
||||||
|
Loading…
Reference in New Issue
Block a user