semantic-source-0.0.0.0: Types and functionality for working with source code

Safe HaskellNone
LanguageHaskell2010

Source.Span

Description

Source position and span information

Mostly taken from purescript's SourcePos definition.

Synopsis

Documentation

data Span Source #

A Span of position information

Constructors

Span 

Fields

Instances
Eq Span Source # 
Instance details

Defined in Source.Span

Methods

(==) :: Span -> Span -> Bool #

(/=) :: Span -> Span -> Bool #

Ord Span Source # 
Instance details

Defined in Source.Span

Methods

compare :: Span -> Span -> Ordering #

(<) :: Span -> Span -> Bool #

(<=) :: Span -> Span -> Bool #

(>) :: Span -> Span -> Bool #

(>=) :: Span -> Span -> Bool #

max :: Span -> Span -> Span #

min :: Span -> Span -> Span #

Show Span Source # 
Instance details

Defined in Source.Span

Methods

showsPrec :: Int -> Span -> ShowS #

show :: Span -> String #

showList :: [Span] -> ShowS #

Generic Span Source # 
Instance details

Defined in Source.Span

Associated Types

type Rep Span :: Type -> Type #

Methods

from :: Span -> Rep Span x #

to :: Rep Span x -> Span #

Semigroup Span Source # 
Instance details

Defined in Source.Span

Methods

(<>) :: Span -> Span -> Span #

sconcat :: NonEmpty Span -> Span #

stimes :: Integral b => b -> Span -> Span #

NFData Span Source # 
Instance details

Defined in Source.Span

Methods

rnf :: Span -> () #

Hashable Span Source # 
Instance details

Defined in Source.Span

Methods

hashWithSalt :: Int -> Span -> Int

hash :: Span -> Int

Lower Span Source # 
Instance details

Defined in Source.Span

Methods

lowerBound :: Span

FromJSON Span Source # 
Instance details

Defined in Source.Span

Methods

parseJSON :: Value -> Parser Span

parseJSONList :: Value -> Parser [Span]

ToJSON Span Source # 
Instance details

Defined in Source.Span

Methods

toJSON :: Span -> Value

toEncoding :: Span -> Encoding

toJSONList :: [Span] -> Value

toEncodingList :: [Span] -> Encoding

HasSpan Span Source # 
Instance details

Defined in Source.Span

Methods

span_ :: Lens' Span Span Source #

start_ :: Lens' Span Pos Source #

end_ :: Lens' Span Pos Source #

type Rep Span Source # 
Instance details

Defined in Source.Span

type Rep Span = D1 (MetaData "Span" "Source.Span" "semantic-source-0.0.0.0-inplace" False) (C1 (MetaCons "Span" PrefixI True) (S1 (MetaSel (Just "start") SourceUnpack SourceStrict DecidedStrict) (Rec0 Pos) :*: S1 (MetaSel (Just "end") SourceUnpack SourceStrict DecidedStrict) (Rec0 Pos)))

point :: Pos -> Span Source #

Construct a Span with a given value for both its start and end positions.

data Pos Source #

Source position information (1-indexed)

Constructors

Pos 

Fields

Instances
Eq Pos Source # 
Instance details

Defined in Source.Span

Methods

(==) :: Pos -> Pos -> Bool #

(/=) :: Pos -> Pos -> Bool #

Ord Pos Source # 
Instance details

Defined in Source.Span

Methods

compare :: Pos -> Pos -> Ordering #

(<) :: Pos -> Pos -> Bool #

(<=) :: Pos -> Pos -> Bool #

(>) :: Pos -> Pos -> Bool #

(>=) :: Pos -> Pos -> Bool #

max :: Pos -> Pos -> Pos #

min :: Pos -> Pos -> Pos #

Show Pos Source # 
Instance details

Defined in Source.Span

Methods

showsPrec :: Int -> Pos -> ShowS #

show :: Pos -> String #

showList :: [Pos] -> ShowS #

Generic Pos Source # 
Instance details

Defined in Source.Span

Associated Types

type Rep Pos :: Type -> Type #

Methods

from :: Pos -> Rep Pos x #

to :: Rep Pos x -> Pos #

NFData Pos Source # 
Instance details

Defined in Source.Span

Methods

rnf :: Pos -> () #

Hashable Pos Source # 
Instance details

Defined in Source.Span

Methods

hashWithSalt :: Int -> Pos -> Int

hash :: Pos -> Int

Lower Pos Source # 
Instance details

Defined in Source.Span

Methods

lowerBound :: Pos

FromJSON Pos Source # 
Instance details

Defined in Source.Span

Methods

parseJSON :: Value -> Parser Pos

parseJSONList :: Value -> Parser [Pos]

ToJSON Pos Source # 
Instance details

Defined in Source.Span

Methods

toJSON :: Pos -> Value

toEncoding :: Pos -> Encoding

toJSONList :: [Pos] -> Value

toEncodingList :: [Pos] -> Encoding

type Rep Pos Source # 
Instance details

Defined in Source.Span

type Rep Pos = D1 (MetaData "Pos" "Source.Span" "semantic-source-0.0.0.0-inplace" False) (C1 (MetaCons "Pos" PrefixI True) (S1 (MetaSel (Just "line") SourceUnpack SourceStrict DecidedStrict) (Rec0 Int) :*: S1 (MetaSel (Just "column") SourceUnpack SourceStrict DecidedStrict) (Rec0 Int)))

line_ :: Lens' Pos Int Source #

class HasSpan a where Source #

"Classy-fields" interface for data types that have spans.

Minimal complete definition

span_

Methods

span_ :: Lens' a Span Source #

start_ :: Lens' a Pos Source #

end_ :: Lens' a Pos Source #

Instances
HasSpan Span Source # 
Instance details

Defined in Source.Span

Methods

span_ :: Lens' Span Span Source #

start_ :: Lens' Span Pos Source #

end_ :: Lens' Span Pos Source #

HasSpan Loc Source # 
Instance details

Defined in Source.Loc

Methods

span_ :: Lens' Loc Span Source #

start_ :: Lens' Loc Pos Source #

end_ :: Lens' Loc Pos Source #