1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

Perform tagging using traverse1_.

This commit is contained in:
Rob Rix 2020-01-13 14:58:09 -05:00
parent 9e966e0ff8
commit 9c4818e827
No known key found for this signature in database
GPG Key ID: 2BE643E01DC032AE
6 changed files with 6 additions and 12 deletions

View File

@ -19,7 +19,6 @@ module Language.Go.Tags
import AST.Element
import Control.Effect.Reader
import Control.Effect.Writer
import Data.Monoid (Ap (..))
import Data.Text as Text
import GHC.Generics
import Source.Loc
@ -96,7 +95,7 @@ gtags
)
=> t Loc
-> m ()
gtags = getAp . Tags.foldMap1 @ToTags (const mempty) (Ap . tags) . Tags.Generics
gtags = Tags.traverse1_ @ToTags (const (pure ())) tags . Tags.Generics
instance (Generic1 t, Tags.GTraversable1 ToTags (Rep1 t)) => ToTagsBy 'Generic t where
tags' = gtags

View File

@ -5,7 +5,6 @@ module Language.Java.Tags
import Control.Effect.Reader
import Control.Effect.Writer
import Data.Monoid (Ap(..))
import GHC.Generics
import Source.Loc
import Source.Range
@ -94,7 +93,7 @@ gtags
)
=> t Loc
-> m ()
gtags = getAp . Tags.foldMap1 @ToTags (const mempty) (Ap . tags) . Tags.Generics
gtags = Tags.traverse1_ @ToTags (const (pure ())) tags . Tags.Generics
instance (Generic1 t, Tags.GTraversable1 ToTags (Rep1 t)) => ToTagsBy 'Generic t where
tags' = gtags

View File

@ -20,7 +20,6 @@ import AST.Element
import Control.Effect.Reader
import Control.Effect.Writer
import Data.Maybe (listToMaybe)
import Data.Monoid (Ap(..))
import Data.List.NonEmpty (NonEmpty(..))
import Data.Text as Text
import GHC.Generics
@ -166,7 +165,7 @@ gtags
)
=> t Loc
-> m ()
gtags = getAp . Tags.foldMap1 @ToTags (const mempty) (Ap . tags) . Tags.Generics
gtags = Tags.traverse1_ @ToTags (const (pure ())) tags . Tags.Generics
instance (Generic1 t, Tags.GTraversable1 ToTags (Rep1 t)) => ToTagsBy 'Generic t where
tags' = gtags

View File

@ -22,7 +22,6 @@ import Control.Effect.Reader
import Control.Effect.State
import Control.Effect.Writer
import Control.Monad
import Data.Monoid (Ap (..))
import Data.Foldable
import Data.Text as Text
import GHC.Generics
@ -311,7 +310,7 @@ gtags
)
=> t Loc
-> m ()
gtags = getAp . Tags.foldMap1 @ToTags (const mempty) (Ap . tags) . Tags.Generics
gtags = Tags.traverse1_ @ToTags (const (pure ())) tags . Tags.Generics
instance (Generic1 t, Tags.GTraversable1 ToTags (Rep1 t)) => ToTagsBy 'Generic t where
tags' = gtags

View File

@ -21,7 +21,6 @@ import AST.Element
import Control.Effect.Reader
import Control.Effect.Writer
import Data.Foldable
import Data.Monoid (Ap (..))
import Data.Text as Text
import GHC.Generics
import Source.Loc
@ -137,7 +136,7 @@ gtags
)
=> t Loc
-> m ()
gtags = getAp . Tags.foldMap1 @ToTags (const mempty) (Ap . tags) . Tags.Generics
gtags = Tags.traverse1_ @ToTags (const (pure ())) tags . Tags.Generics
instance (Generic1 t, Tags.GTraversable1 ToTags (Rep1 t)) => ToTagsBy 'Generic t where
tags' = gtags

View File

@ -21,7 +21,6 @@ import AST.Element
import Control.Effect.Reader
import Control.Effect.Writer
import Data.Foldable
import Data.Monoid (Ap (..))
import Data.Text as Text
import GHC.Generics
import Source.Loc
@ -129,7 +128,7 @@ gtags
)
=> t Loc
-> m ()
gtags = getAp . Tags.foldMap1 @ToTags (const mempty) (Ap . tags) . Tags.Generics
gtags = Tags.traverse1_ @ToTags (const (pure ())) tags . Tags.Generics
instance (Generic1 t, Tags.GTraversable1 ToTags (Rep1 t)) => ToTagsBy 'Generic t where
tags' = gtags