From 006ec80a067397033ae00b804bdc0086a7f19e9a Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 25 Jan 2017 20:16:13 -0500 Subject: [PATCH] =?UTF-8?q?Summarize=20all=20of=20indexed=20nodes=E2=80=99?= =?UTF-8?q?=20children,=20not=20just=20the=20first=20child.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DiffSummary.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DiffSummary.hs b/src/DiffSummary.hs index 2afdb8f4a..b87854a1c 100644 --- a/src/DiffSummary.hs +++ b/src/DiffSummary.hs @@ -16,6 +16,7 @@ import Category as C import Data.Functor.Both hiding (fst, snd) import qualified Data.Functor.Both as Both import Data.Functor.Listable +import Data.List.NonEmpty (nonEmpty) import qualified Data.Text as Text import Data.Text.Listable import Data.Record @@ -196,7 +197,7 @@ toTermName source term = case unwrap term of S.Defer expr -> toTermName' expr S.AnonymousFunction params _ -> "anonymous" <> paramsToArgNames params S.Fixed children -> termNameFromChildren term children - S.Indexed children -> fromMaybe "branch" $ (toCategoryName . category) . extract <$> head children + S.Indexed children -> maybe "branch" sconcat (nonEmpty (intersperse ", " (toTermName' <$> children))) Leaf leaf -> toS leaf S.Assignment identifier _ -> toTermName' identifier S.Function identifier _ _ -> toTermName' identifier