1
1
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:
Rob Rix 2016-04-04 15:41:01 -04:00
parent fd150be38e
commit de6696ce50

View File

@ -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