1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Implement the empty cases by pattern matching.

This commit is contained in:
Rob Rix 2015-11-18 07:27:19 -08:00
parent 13499cc520
commit 676ef16162

View File

@ -4,6 +4,6 @@ import Patch
import Diff import Diff
ses :: Eq a => [a] -> [a] -> [Either (Patch a) (a, a)] ses :: Eq a => [a] -> [a] -> [Either (Patch a) (a, a)]
ses a b | Prelude.null a = (Left . Insert) <$> b ses [] b = (Left . Insert) <$> b
ses a b | Prelude.null b = (Left . Delete) <$> a ses a [] = (Left . Delete) <$> a
ses (a : as) (b : bs) | a == b = Right (a, b) : ses as bs ses (a : as) (b : bs) | a == b = Right (a, b) : ses as bs