1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Define a point constructor for Span.

This commit is contained in:
Rob Rix 2019-09-20 17:01:16 -04:00
parent 935acb47c3
commit 6356443dd1
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -4,6 +4,7 @@
-- Mostly taken from purescript's SourcePos definition.
module Source.Span
( Span(..)
, point
, spanFromSrcLoc
, Pos(..)
, line_
@ -47,6 +48,9 @@ instance Lower Span where
lowerBound = Span lowerBound lowerBound
point :: Pos -> Span
point p = Span p p
spanFromSrcLoc :: SrcLoc -> Span
spanFromSrcLoc s = Span (Pos (srcLocStartLine s) (srcLocStartCol s)) (Pos (srcLocEndLine s) (srcLocEndCol s))