1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 09:15:01 +03:00

Remove last from Prologue

This commit is contained in:
joshvera 2016-12-01 16:03:45 -05:00
parent e9489780d6
commit 9cd616f7b3
3 changed files with 3 additions and 4 deletions

View File

@ -155,7 +155,7 @@ determiner (LeafInfo "else block" _ _) = "an"
determiner (LeafInfo "ensure block" _ _) = "an" determiner (LeafInfo "ensure block" _ _) = "an"
determiner (LeafInfo "when block" _ _) = "a" determiner (LeafInfo "when block" _ _) = "a"
determiner (LeafInfo "anonymous function" _ _) = "an" determiner (LeafInfo "anonymous function" _ _) = "an"
determiner (BranchInfo bs _ _) = determiner (last bs) determiner (BranchInfo bs _ _) = maybe "" determiner (snd <$> unsnoc bs)
determiner _ = "the" determiner _ = "the"
toLeafInfos :: DiffInfo -> [JSONSummary Doc SourceSpan] toLeafInfos :: DiffInfo -> [JSONSummary Doc SourceSpan]

View File

@ -5,11 +5,10 @@ module Prologue
, (***) , (***)
, hylo, cata, para, ana , hylo, cata, para, ana
, module Data.Hashable , module Data.Hashable
, last
) where ) where
import Protolude as X import Protolude as X
import Data.List (lookup, last) import Data.List (lookup)
import Control.Comonad.Trans.Cofree as X import Control.Comonad.Trans.Cofree as X
import Control.Monad.Trans.Free as X import Control.Monad.Trans.Free as X

View File

@ -103,7 +103,7 @@ sourceSpanToRange source SourceSpan{..} = Range start end
rangeToSourceSpan :: Source Char -> Range -> SourceSpan rangeToSourceSpan :: Source Char -> Range -> SourceSpan
rangeToSourceSpan source range@Range{} = SourceSpan startPos endPos rangeToSourceSpan source range@Range{} = SourceSpan startPos endPos
where startPos = maybe (SourcePos 1 1) (toStartPos 1) (head lineRanges) where startPos = maybe (SourcePos 1 1) (toStartPos 1) (head lineRanges)
endPos = toEndPos (length lineRanges) (last lineRanges) endPos = toEndPos (length lineRanges) (fromMaybe (rangeAt 0) (snd <$> unsnoc lineRanges))
lineRanges = actualLineRanges range source lineRanges = actualLineRanges range source
toStartPos line range = SourcePos line (start range) toStartPos line range = SourcePos line (start range)
toEndPos line range = SourcePos line (end range) toEndPos line range = SourcePos line (end range)