1
1
mirror of https://github.com/github/semantic.git synced 2024-12-18 20:31:55 +03:00

Define Patch’s Pretty1 instance generically.

This commit is contained in:
Rob Rix 2017-08-23 12:07:39 -04:00
parent 2c722a59c7
commit 13df366dcd

View File

@ -89,10 +89,7 @@ instance Crosswalk Patch where
crosswalk f (Insert b) = Insert <$> f b
crosswalk f (Delete a) = Delete <$> f a
instance Pretty1 Patch where
liftPretty p _ (Replace a b) = nest 2 (vsep [ pretty ("Replace" :: String), p a, p b ])
liftPretty p _ (Insert b) = nest 2 (vsep [ pretty ("Insert" :: String), p b ])
liftPretty p _ (Delete a) = nest 2 (vsep [ pretty ("Delete" :: String), p a ])
instance Pretty1 Patch where liftPretty = genericLiftPretty
instance Pretty a => Pretty (Patch a) where
pretty = liftPretty pretty prettyList