From 51b55cc1b49c1285ecc2448cf8eaffb15ce911cd Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 14 Jul 2016 14:19:15 -0400 Subject: [PATCH] Generalize toTermName over record annotations. --- src/DiffSummary.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DiffSummary.hs b/src/DiffSummary.hs index 2efbe689f..9b86b02c7 100644 --- a/src/DiffSummary.hs +++ b/src/DiffSummary.hs @@ -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