1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 11:02:26 +03:00

Define a custom TaggableBy instance for TermF.

This commit is contained in:
Rob Rix 2019-09-18 12:49:30 -04:00
parent 3ea6914128
commit 05c1a724ab
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -141,8 +141,9 @@ subtractLocation a b = subtractRange (locationByteRange a) (locationByteRange b)
-- Instances
type family TaggableInstance (t :: * -> *) :: Strategy where
TaggableInstance (Sum _) = 'Custom
TaggableInstance _ = 'Default
TaggableInstance (Sum _) = 'Custom
TaggableInstance (TermF _ _) = 'Custom
TaggableInstance _ = 'Default
instance TaggableBy 'Default t
@ -151,6 +152,11 @@ instance Apply Taggable fs => TaggableBy 'Custom (Sum fs) where
snippet' x = apply @Taggable (snippet x)
symbolName' = apply @Taggable symbolName
instance Taggable a => TaggableBy 'Custom (TermF a Location) where
docsLiteral' l t = docsLiteral l (termFOut t)
snippet' ann t = snippet ann (termFOut t)
symbolName' t = symbolName (termFOut t)
instance Apply Taggable fs => Taggable (Sum fs) where
docsLiteral a = apply @Taggable (docsLiteral a)
snippet x = apply @Taggable (snippet x)