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:
parent
3ea6914128
commit
05c1a724ab
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user