1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 18:36:27 +03:00

Revert "Revert "Define a Crosswalk instance for Patch.""

This reverts commit 20d96850fa7ee2b1ad3c949b128186eaa8f22f6b.
This commit is contained in:
Rob Rix 2017-05-11 14:19:34 -04:00
parent 344bff67ce
commit 4ef3604a65

View File

@ -16,6 +16,7 @@ module Patch
, patchType , patchType
) where ) where
import Data.Align
import Data.Functor.Listable import Data.Functor.Listable
import Data.These import Data.These
import Prologue import Prologue
@ -90,3 +91,8 @@ instance Listable1 Patch where
instance Listable a => Listable (Patch a) where instance Listable a => Listable (Patch a) where
tiers = tiers1 tiers = tiers1
instance Crosswalk Patch where
crosswalk f (Replace a b) = alignWith (these Delete Insert Replace) (f a) (f b)
crosswalk f (Insert b) = Insert <$> f b
crosswalk f (Delete a) = Delete <$> f a