mirror of
https://github.com/github/semantic.git
synced 2024-11-24 17:04:47 +03:00
Remove Lower instances for Span and Pos
This commit is contained in:
parent
d0fca24ef5
commit
78e94e37f7
@ -75,7 +75,7 @@ totalRange = Range 0 . B.length . bytes
|
||||
|
||||
-- | Return a 'Span' that covers the entire text.
|
||||
totalSpan :: Source -> Span
|
||||
totalSpan source = Span lowerBound (Pos (Prelude.length ranges) (succ (end lastRange - start lastRange))) where
|
||||
totalSpan source = Span (Pos 1 1) (Pos (Prelude.length ranges) (succ (end lastRange - start lastRange))) where
|
||||
ranges = lineRanges source
|
||||
lastRange = fromMaybe lowerBound (getLast (foldMap (Last . Just) ranges))
|
||||
|
||||
|
@ -18,7 +18,6 @@ import Control.DeepSeq (NFData)
|
||||
import Data.Aeson ((.:), (.=))
|
||||
import qualified Data.Aeson as A
|
||||
import Data.Hashable (Hashable)
|
||||
import Data.Semilattice.Lower (Lower (..))
|
||||
import GHC.Generics (Generic)
|
||||
import GHC.Stack (SrcLoc (..))
|
||||
|
||||
@ -46,10 +45,6 @@ instance A.FromJSON Span where
|
||||
<$> o .: "start"
|
||||
<*> o .: "end"
|
||||
|
||||
instance Lower Span where
|
||||
lowerBound = Span lowerBound lowerBound
|
||||
|
||||
|
||||
-- | Construct a Span with a given value for both its start and end positions.
|
||||
point :: Pos -> Span
|
||||
point p = Span p p
|
||||
@ -83,10 +78,6 @@ instance A.FromJSON Pos where
|
||||
[ line, col ] <- A.parseJSON arr
|
||||
pure $ Pos line col
|
||||
|
||||
instance Lower Pos where
|
||||
lowerBound = Pos 1 1
|
||||
|
||||
|
||||
line_, column_ :: Lens' Pos Int
|
||||
line_ = lens line (\p l -> p { line = l })
|
||||
column_ = lens column (\p l -> p { column = l })
|
||||
|
Loading…
Reference in New Issue
Block a user