1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

Extract function instead of lambda

This commit is contained in:
Timothy Clem 2017-11-20 15:09:13 -08:00
parent 57dd145dc2
commit 94690bebaf

View File

@ -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')