mirror of
https://github.com/github/semantic.git
synced 2024-12-22 06:11:49 +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.Both
|
||||
import Data.OrderedMap
|
||||
import Data.Record
|
||||
import Data.Text as Text (intercalate, unpack)
|
||||
|
||||
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
|
||||
Fixed children -> fromMaybe "EmptyFixedNode" $ (toCategoryName . category) . extract <$> head children
|
||||
Indexed children -> fromMaybe "EmptyIndexedNode" $ (toCategoryName . category) . extract <$> head children
|
||||
|
Loading…
Reference in New Issue
Block a user