1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 16:02:43 +03:00

Use semantic-source’s definition of Span.

This commit is contained in:
Rob Rix 2019-10-07 17:16:01 -04:00
parent b082341704
commit 0b642f579d
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -17,9 +17,9 @@ import Control.Effect.Error
import Control.Effect.Fail
import Control.Effect.Reader
import Data.Text (Text, pack)
import Data.Text.Prettyprint.Doc (Pretty (..))
import GHC.Stack
import Prelude hiding (fail)
import Source.Span
data Loc = Loc
{ locPath :: !Text
@ -30,27 +30,9 @@ data Loc = Loc
interactive :: Loc
interactive = Loc "<interactive>" emptySpan
data Span = Span
{ spanStart :: {-# UNPACK #-} !Pos
, spanEnd :: {-# UNPACK #-} !Pos
}
deriving (Eq, Ord, Show)
instance Pretty Span where
pretty (Span s e) = pretty s <> "-" <> pretty e
emptySpan :: Span
emptySpan = Span (Pos 1 1) (Pos 1 1)
data Pos = Pos
{ posLine :: {-# UNPACK #-} !Int
, posCol :: {-# UNPACK #-} !Int
}
deriving (Eq, Ord, Show)
instance Pretty Pos where
pretty (Pos l c) = pretty l <> ":" <> pretty c
here :: HasCallStack => Maybe Loc
here = stackLoc callStack