mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Generalize toTermName over record annotations.
This commit is contained in:
parent
177af03bd3
commit
51b55cc1b4
@ -12,11 +12,12 @@ import Category
|
|||||||
import Data.Functor.Foldable as Foldable
|
import Data.Functor.Foldable as Foldable
|
||||||
import Data.Functor.Both
|
import Data.Functor.Both
|
||||||
import Data.OrderedMap
|
import Data.OrderedMap
|
||||||
|
import Data.Record
|
||||||
import Data.Text as Text (intercalate, unpack)
|
import Data.Text as Text (intercalate, unpack)
|
||||||
|
|
||||||
data DiffInfo = DiffInfo { categoryName :: Text, termName :: Text } deriving (Eq, Show)
|
data DiffInfo = DiffInfo { categoryName :: Text, termName :: Text } deriving (Eq, Show)
|
||||||
|
|
||||||
toTermName :: HasCategory leaf => Term leaf Info -> Text
|
toTermName :: (HasCategory leaf, HasField fields Category) => Term leaf (Record fields) -> Text
|
||||||
toTermName term = case unwrap term of
|
toTermName term = case unwrap term of
|
||||||
Fixed children -> fromMaybe "EmptyFixedNode" $ (toCategoryName . category) . extract <$> head children
|
Fixed children -> fromMaybe "EmptyFixedNode" $ (toCategoryName . category) . extract <$> head children
|
||||||
Indexed children -> fromMaybe "EmptyIndexedNode" $ (toCategoryName . category) . extract <$> head children
|
Indexed children -> fromMaybe "EmptyIndexedNode" $ (toCategoryName . category) . extract <$> head children
|
||||||
|
Loading…
Reference in New Issue
Block a user