mirror of
https://github.com/github/semantic.git
synced 2024-12-23 14:54:16 +03:00
Use splitAt to bind & clarify the roles of the portions of bs.
This commit is contained in:
parent
1ecff8e9b1
commit
0f2c693294
@ -15,8 +15,8 @@ class Functor f => Align f where
|
|||||||
|
|
||||||
instance Align [] where
|
instance Align [] where
|
||||||
nil = []
|
nil = []
|
||||||
align as bs | la < lb = (That <$> take (lb - la) bs) ++ zipWith These as (drop (lb - la) bs)
|
align as bs | la < lb, (prefix, overlap) <- splitAt (lb - la) bs = (That <$> prefix) ++ zipWith These as overlap
|
||||||
| la > lb = (This <$> take (la - lb) as) ++ zipWith These (drop (la - lb) as) bs
|
| la > lb, (prefix, overlap) <- splitAt (la - lb) as = (This <$> prefix) ++ zipWith These overlap bs
|
||||||
| otherwise = zipWith These as bs
|
| otherwise = zipWith These as bs
|
||||||
where (la, lb) = (length as, length bs)
|
where (la, lb) = (length as, length bs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user