From 94690bebafda807c980369ff4cbf141a82e217be Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Mon, 20 Nov 2017 15:09:13 -0800 Subject: [PATCH] Extract function instead of lambda --- src/Renderer/TOC.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Renderer/TOC.hs b/src/Renderer/TOC.hs index ca685db36..e6ed1945a 100644 --- a/src/Renderer/TOC.hs +++ b/src/Renderer/TOC.hs @@ -135,7 +135,8 @@ class CustomHasDeclaration syntax where instance CustomHasDeclaration Markdown.Heading where customToDeclaration Blob{..} ann (Markdown.Heading level terms _) = Just $ HeadingDeclaration (headingText terms) level - where headingText terms = getSource $ maybe (byteRange ann) sconcat (nonEmpty (fmap (\ (Term (In ann _), _) -> (byteRange ann)) (toList terms))) + where headingText terms = getSource $ maybe (byteRange ann) sconcat (nonEmpty (headingByteRange <$> toList terms)) + headingByteRange (Term (In ann _), _) = byteRange ann getSource = firstLine . toText . flip Source.slice blobSource firstLine = T.takeWhile (/= '\n')