language-ninja-0.1.0: A library for dealing with the Ninja build language.

CopyrightCopyright 2017 Awake Security
LicenseApache-2.0
Maintaineropensource@awakesecurity.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Language.Ninja.Misc

Contents

Description

Utility types and functions for the rest of language-ninja.

This module re-exports all of the modules under the Language.Ninja.Misc namespace for convenience.

It is recommended that you import it with the following style:

import qualified Language.Ninja.Misc as Misc

Since: 0.1.0

Synopsis

Language.Ninja.Misc.Command

data Command Source #

This type represents a POSIX sh command line.

Since: 0.1.0

Instances

Eq Command Source # 

Methods

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

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

Ord Command Source # 
Read Command Source # 
Show Command Source # 
Generic Command Source # 

Associated Types

type Rep Command :: * -> * #

Methods

from :: Command -> Rep Command x #

to :: Rep Command x -> Command #

Hashable Command Source # 

Methods

hashWithSalt :: Int -> Command -> Int #

hash :: Command -> Int #

ToJSON Command Source # 
FromJSON Command Source # 
NFData Command Source # 

Methods

rnf :: Command -> () #

(Monad m, Serial m Text) => Serial m Command Source #

Uses the underlying Text instance.

Since: 0.1.0

Methods

series :: Series m Command #

(Monad m, CoSerial m Text) => CoSerial m Command Source #

Uses the underlying Text instance.

Since: 0.1.0

Methods

coseries :: Series m b -> Series m (Command -> b) #

type Rep Command Source # 
type Rep Command = D1 (MetaData "Command" "Language.Ninja.Misc.Command" "language-ninja-0.1.0-CTXTL0Lugm4Llo91nN4SIr" True) (C1 (MetaCons "MkCommand" PrefixI True) (S1 (MetaSel (Just Symbol "_commandText") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

makeCommand :: Text -> Command Source #

Constructor for a Command.

Since: 0.1.0

commandText :: Iso' Command Text Source #

An isomorphism between a Command and its underlying Text.

Since: 0.1.0

Language.Ninja.Misc.Path

data Path Source #

This type represents a Unix path string.

Since: 0.1.0

Instances

Eq Path Source # 

Methods

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

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

Ord Path Source # 

Methods

compare :: Path -> Path -> Ordering #

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

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

(>) :: Path -> Path -> Bool #

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

max :: Path -> Path -> Path #

min :: Path -> Path -> Path #

Read Path Source # 
Show Path Source # 

Methods

showsPrec :: Int -> Path -> ShowS #

show :: Path -> String #

showList :: [Path] -> ShowS #

IsString Path Source # 

Methods

fromString :: String -> Path #

Generic Path Source # 

Associated Types

type Rep Path :: * -> * #

Methods

from :: Path -> Rep Path x #

to :: Rep Path x -> Path #

Hashable Path Source # 

Methods

hashWithSalt :: Int -> Path -> Int #

hash :: Path -> Int #

ToJSON Path Source # 
ToJSONKey Path Source # 
FromJSON Path Source # 
FromJSONKey Path Source # 
NFData Path Source # 

Methods

rnf :: Path -> () #

(Monad m, Serial m Text) => Serial m Path Source #

Uses the underlying IText instance.

Since: 0.1.0

Methods

series :: Series m Path #

(Monad m, CoSerial m Text) => CoSerial m Path Source #

Uses the underlying IText instance.

Since: 0.1.0

Methods

coseries :: Series m b -> Series m (Path -> b) #

type Rep Path Source # 
type Rep Path = D1 (MetaData "Path" "Language.Ninja.Misc.Path" "language-ninja-0.1.0-CTXTL0Lugm4Llo91nN4SIr" True) (C1 (MetaCons "MkPath" PrefixI True) (S1 (MetaSel (Just Symbol "_pathIText") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 IText)))

makePath :: Text -> Path Source #

Construct a Path from some Text.

Since: 0.1.0

pathIText :: Iso' Path IText Source #

An isomorphism between a Path and its underlying IText.

Since: 0.1.0

pathText :: Iso' Path Text Source #

An isomorphism that gives access to a Text-typed view of a Path, even though the underlying data has type IText.

This is equivalent to pathIText . from Ninja.itext.

Since: 0.1.0

pathString :: Iso' Path String Source #

An isomorphism that gives access to a String-typed view of a Path.

Since: 0.1.0

pathFP :: Iso' Path FilePath Source #

An isomorphism between a Path and a FilePath from system-filepath. This uses decodeString and encodeString, so all the caveats on those functions apply here.

Since: 0.1.0

Language.Ninja.Misc.IText

data IText Source #

An interned (hash-consed) text type. This is a newtype over InternedText from the intern package.

Since: 0.1.0

Instances

Eq IText Source # 

Methods

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

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

Ord IText Source #

The Ord instance in intern compares hashes rather than values.

Since: 0.1.0

Methods

compare :: IText -> IText -> Ordering #

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

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

(>) :: IText -> IText -> Bool #

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

max :: IText -> IText -> IText #

min :: IText -> IText -> IText #

Read IText Source #

Inverse of the Show instance.

Since: 0.1.0

Show IText Source #

Displays an IText such that fromString is inverse to show.

Since: 0.1.0

Methods

showsPrec :: Int -> IText -> ShowS #

show :: IText -> String #

showList :: [IText] -> ShowS #

IsString IText Source # 

Methods

fromString :: String -> IText #

Generic IText Source # 

Associated Types

type Rep IText :: * -> * #

Methods

from :: IText -> Rep IText x #

to :: Rep IText x -> IText #

Hashable IText Source #

Uses the Hashable instance for Text. Not very efficient.

TODO: perhaps switch to hashing the identifier, since this is likely pretty hot code given all the HashMap Target … types all over the place.

Since: 0.1.0

Methods

hashWithSalt :: Int -> IText -> Int #

hash :: IText -> Int #

ToJSON IText Source #

Converts to JSON string via uninternText.

Since: 0.1.0

ToJSONKey IText Source #

Converts to JSON string via uninternText.

Since: 0.1.0

FromJSON IText Source #

Inverse of the ToJSON instance.

Since: 0.1.0

FromJSONKey IText Source #

Inverse of the ToJSONKey instance.

Since: 0.1.0

NFData IText Source #

Defined by rnf a = seq a (), since IText is a newtype of strict types.

Since: 0.1.0

Methods

rnf :: IText -> () #

(Monad m, Serial m Text) => Serial m IText Source #

Uses the Text instance.

Since: 0.1.0

Methods

series :: Series m IText #

(Monad m, CoSerial m Text) => CoSerial m IText Source #

Uses the Text instance.

Since: 0.1.0

Methods

coseries :: Series m b -> Series m (IText -> b) #

type Rep IText Source # 
type Rep IText = D1 (MetaData "IText" "Language.Ninja.Misc.IText" "language-ninja-0.1.0-CTXTL0Lugm4Llo91nN4SIr" True) (C1 (MetaCons "MkIText" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 InternedText)))

uninternText :: IText -> Text Source #

Get the Text corresponding to the given IText value.

>>> uninternText ("foobar" :: IText)
"foobar"

Since: 0.1.0

internText :: Text -> IText Source #

Intern a Text value, resulting in an IText value.

uninternText (internText (Text.pack x)) == Text.pack x
>>> internText ("foobar" :: Text)
"foobar"

Since: 0.1.0

itext :: Iso' Text IText Source #

An Iso' between Text and IText.

(Lens.view itext (fromString x)) == fromString x
(Lens.view (Lens.from itext) (fromString x)) == fromString x
>>> (Lens.view itext ("foobar" :: Text)) :: IText
"foobar"
>>> (Lens.view (Lens.from itext) ("foobar" :: IText)) :: Text
"foobar"

Since: 0.1.0

Language.Ninja.Misc.Positive

data Positive Source #

This type represents a positive number; i.e.: an integer greater than zero.

Since: 0.1.0

Instances

Enum Positive Source # 
Eq Positive Source # 
Integral Positive Source # 
Num Positive Source #

This instance uses error to preserve the Positive invariant.

Since: 0.1.0

Ord Positive Source # 
Read Positive Source # 
Real Positive Source # 
Show Positive Source # 
Generic Positive Source # 

Associated Types

type Rep Positive :: * -> * #

Methods

from :: Positive -> Rep Positive x #

to :: Rep Positive x -> Positive #

Hashable Positive Source # 

Methods

hashWithSalt :: Int -> Positive -> Int #

hash :: Positive -> Int #

ToJSON Positive Source # 
FromJSON Positive Source # 
NFData Positive Source # 

Methods

rnf :: Positive -> () #

Monad m => Serial m Positive Source #

Uses the underlying Int instance.

Since: 0.1.0

Methods

series :: Series m Positive #

Monad m => CoSerial m Positive Source #

Uses the underlying Int instance.

Since: 0.1.0

Methods

coseries :: Series m b -> Series m (Positive -> b) #

type Rep Positive Source # 
type Rep Positive = D1 (MetaData "Positive" "Language.Ninja.Misc.Positive" "language-ninja-0.1.0-CTXTL0Lugm4Llo91nN4SIr" True) (C1 (MetaCons "MkPositive" PrefixI True) (S1 (MetaSel (Just Symbol "_fromPositive") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

makePositive :: Int -> Maybe Positive Source #

Constructor for a Positive.

Since: 0.1.0

fromPositive :: Getter Positive Int Source #

A Getter for the Int underlying a Positive.

Since: 0.1.0

Language.Ninja.Misc.Annotated

class Functor ty => Annotated ty where Source #

If you have some type that represents an AST node, it is often useful to add a polymorphic "annotation field" to it, which is used for things like source positions.

Specifically, suppose we have the following AST node type:

data Foo = Foo { _fooBar :: !Bar, _fooBaz :: !Baz } deriving (…)

Then an annotation field is added by the following process:

  1. Add an extra (final) type parameter ann to the type.
  2. Add an extra field _fooAnn :: !ann.
  3. Derive instances of Functor, Foldable, and Traversable.
  4. If the type is recursive, add a Plated instance. See Language.Ninja.AST.Expr for a complete example of this.
  5. Write an Annotated instance with the canonical lens given by the _fooAnn field. There are plenty of examples around this library.

The end result then looks like:

data Foo ann
  = Foo
    { _fooAnn :: !ann
    , _fooBar :: !Bar
    , _fooBaz :: !Baz
    }
  deriving (…, Functor, Foldable, Traversable)

instance Annotated Foo where
  annotation' = …

Since: 0.1.0

Minimal complete definition

annotation'

Methods

annotation' :: (ann -> ann') -> Lens (ty ann) (ty ann') ann ann' Source #

Given a function that is used when fmaping any subterms, return a lens into the "annotation" field.

When writing an instance, keep in mind that annotation' id should just be the typical definition for a lens into the annotation field.

It should also be true that for any f :: B -> C and g :: A -> B,

annotation' (f . g) == annotation' f . annotation' g

Since: 0.1.0

Instances

Annotated Expr Source #

The usual definition for Annotated.

Since: 0.1.0

Methods

annotation' :: (ann -> ann') -> Lens (Expr ann) (Expr ann') ann ann' Source #

Annotated Rule Source #

The usual definition for Annotated.

Since: 0.1.0

Methods

annotation' :: (ann -> ann') -> Lens (Rule ann) (Rule ann') ann ann' Source #

Annotated Deps Source #

The usual definition for Annotated.

Since: 0.1.0

Methods

annotation' :: (ann -> ann') -> Lens (Deps ann) (Deps ann') ann ann' Source #

Annotated Build Source #

The usual definition for Annotated.

Since: 0.1.0

Methods

annotation' :: (ann -> ann') -> Lens (Build ann) (Build ann') ann ann' Source #

Annotated Ninja Source #

The usual definition for Annotated.

Since: 0.1.0

Methods

annotation' :: (ann -> ann') -> Lens (Ninja ann) (Ninja ann') ann ann' Source #

Annotated LBuild Source #

The usual definition for Annotated.

Since: 0.1.0

Methods

annotation' :: (ann -> ann') -> Lens (LBuild ann) (LBuild ann') ann ann' Source #

Annotated LName Source #

The usual definition for Annotated.

Since: 0.1.0

Methods

annotation' :: (ann -> ann') -> Lens (LName ann) (LName ann') ann ann' Source #

Annotated Lexeme Source #

The usual definition for Annotated.

Since: 0.1.0

Methods

annotation' :: (ann -> ann') -> Lens (Lexeme ann) (Lexeme ann') ann ann' Source #

annotation :: Annotated ty => Lens' (ty ann) ann Source #

This is just shorthand for annotation' id.

Since: 0.1.0

Language.Ninja.Misc.Located

data Located t Source #

This datatype represents a value annotated with a source location.

Since: 0.1.0

Instances

Functor Located Source # 

Methods

fmap :: (a -> b) -> Located a -> Located b #

(<$) :: a -> Located b -> Located a #

Foldable Located Source # 

Methods

fold :: Monoid m => Located m -> m #

foldMap :: Monoid m => (a -> m) -> Located a -> m #

foldr :: (a -> b -> b) -> b -> Located a -> b #

foldr' :: (a -> b -> b) -> b -> Located a -> b #

foldl :: (b -> a -> b) -> b -> Located a -> b #

foldl' :: (b -> a -> b) -> b -> Located a -> b #

foldr1 :: (a -> a -> a) -> Located a -> a #

foldl1 :: (a -> a -> a) -> Located a -> a #

toList :: Located a -> [a] #

null :: Located a -> Bool #

length :: Located a -> Int #

elem :: Eq a => a -> Located a -> Bool #

maximum :: Ord a => Located a -> a #

minimum :: Ord a => Located a -> a #

sum :: Num a => Located a -> a #

product :: Num a => Located a -> a #

Traversable Located Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Located a -> f (Located b) #

sequenceA :: Applicative f => Located (f a) -> f (Located a) #

mapM :: Monad m => (a -> m b) -> Located a -> m (Located b) #

sequence :: Monad m => Located (m a) -> m (Located a) #

(Monad m, Serial m Text, Serial m t) => Serial m (Located t) Source #

Default Serial instance via Generic.

Since: 0.1.0

Methods

series :: Series m (Located t) #

(Monad m, CoSerial m Text, CoSerial m t) => CoSerial m (Located t) Source #

Default CoSerial instance via Generic.

Since: 0.1.0

Methods

coseries :: Series m b -> Series m (Located t -> b) #

Eq t => Eq (Located t) Source # 

Methods

(==) :: Located t -> Located t -> Bool #

(/=) :: Located t -> Located t -> Bool #

Show t => Show (Located t) Source # 

Methods

showsPrec :: Int -> Located t -> ShowS #

show :: Located t -> String #

showList :: [Located t] -> ShowS #

Generic (Located t) Source # 

Associated Types

type Rep (Located t) :: * -> * #

Methods

from :: Located t -> Rep (Located t) x #

to :: Rep (Located t) x -> Located t #

Hashable t => Hashable (Located t) Source #

Default Hashable instance via Generic.

Since: 0.1.0

Methods

hashWithSalt :: Int -> Located t -> Int #

hash :: Located t -> Int #

ToJSON t => ToJSON (Located t) Source #

Converts to {position: …, value: …}.

Since: 0.1.0

FromJSON t => FromJSON (Located t) Source #

Inverse of the ToJSON instance.

Since: 0.1.0

NFData t => NFData (Located t) Source #

Default NFData instance via Generic.

Since: 0.1.0

Methods

rnf :: Located t -> () #

type Rep (Located t) Source # 
type Rep (Located t) = D1 (MetaData "Located" "Language.Ninja.Misc.Located" "language-ninja-0.1.0-CTXTL0Lugm4Llo91nN4SIr" False) (C1 (MetaCons "MkLocated" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_locatedPos") SourceUnpack SourceStrict DecidedUnpack) (Rec0 Position)) (S1 (MetaSel (Just Symbol "_locatedVal") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 t))))

tokenize :: Maybe Path -> Text -> [Located Text] Source #

Given path :: Maybe Path and a text :: Text, do the following:

  • Remove all '\r' characters from the text.
  • Split the text into chunks that are guaranteed not to contain newlines or whitespace, and which are annotated with their location.

Since: 0.1.0

tokenizeFile :: MonadReadFile m => Path -> m [Located Text] Source #

Read the file at the given Path and then run tokenize on the resulting Text.

Since: 0.1.0

tokenizeText :: Text -> [Located Text] Source #

This function is equivalent to tokenize Nothing.

Since: 0.1.0

locatedPos :: Lens' (Located t) Position Source #

The position of this located value.

Since: 0.1.0

locatedVal :: Lens' (Located t) t Source #

The value underlying this located value.

Since: 0.1.0

data Spans Source #

A type representing a set of source spans.

Since: 0.1.0

Instances

Eq Spans Source # 

Methods

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

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

Show Spans Source # 

Methods

showsPrec :: Int -> Spans -> ShowS #

show :: Spans -> String #

showList :: [Spans] -> ShowS #

Generic Spans Source # 

Associated Types

type Rep Spans :: * -> * #

Methods

from :: Spans -> Rep Spans x #

to :: Rep Spans x -> Spans #

Semigroup Spans Source # 

Methods

(<>) :: Spans -> Spans -> Spans #

sconcat :: NonEmpty Spans -> Spans #

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

Monoid Spans Source # 

Methods

mempty :: Spans #

mappend :: Spans -> Spans -> Spans #

mconcat :: [Spans] -> Spans #

Hashable Spans Source # 

Methods

hashWithSalt :: Int -> Spans -> Int #

hash :: Spans -> Int #

ToJSON Spans Source # 
FromJSON Spans Source # 
NFData Spans Source # 

Methods

rnf :: Spans -> () #

(Monad m, Serial m (HashSet Span)) => Serial m Spans Source #

Default Serial instance via Generic.

Since: 0.1.0

Methods

series :: Series m Spans #

(Monad m, CoSerial m (HashSet Span)) => CoSerial m Spans Source #

Default CoSerial instance via Generic.

Since: 0.1.0

Methods

coseries :: Series m b -> Series m (Spans -> b) #

type Rep Spans Source # 
type Rep Spans = D1 (MetaData "Spans" "Language.Ninja.Misc.Located" "language-ninja-0.1.0-CTXTL0Lugm4Llo91nN4SIr" True) (C1 (MetaCons "MkSpans" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (HashSet Span))))

makeSpans :: [Span] -> Spans Source #

Construct a Spans from a list of Spans.

Since: 0.1.0

spansSet :: Iso' Spans (HashSet Span) Source #

A lens into the HashSet Span underlying a value of type Spans.

Since: 0.1.0

data Span Source #

Represents a span of source code.

Since: 0.1.0

Instances

Eq Span Source # 

Methods

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

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

Show Span Source # 

Methods

showsPrec :: Int -> Span -> ShowS #

show :: Span -> String #

showList :: [Span] -> ShowS #

Generic Span Source # 

Associated Types

type Rep Span :: * -> * #

Methods

from :: Span -> Rep Span x #

to :: Rep Span x -> Span #

Hashable Span Source #

Default Hashable instance via Generic.

Since: 0.1.0

Methods

hashWithSalt :: Int -> Span -> Int #

hash :: Span -> Int #

ToJSON Span Source #

Converts to {file: …, start: …, end: …}.

Since: 0.1.0

FromJSON Span Source #

Inverse of the ToJSON instance.

Since: 0.1.0

NFData Span Source #

Default NFData instance via Generic.

Since: 0.1.0

Methods

rnf :: Span -> () #

(Monad m, Serial m Text) => Serial m Span Source #

Default Serial instance via Generic.

Since: 0.1.0

Methods

series :: Series m Span #

(Monad m, CoSerial m Text) => CoSerial m Span Source #

Default CoSerial instance via Generic.

Since: 0.1.0

Methods

coseries :: Series m b -> Series m (Span -> b) #

type Rep Span Source # 

makeSpan Source #

Arguments

:: Maybe Path

The file in which this span resides, if any.

-> Offset

The start offset.

-> Offset

The end offset.

-> Span 

Construct a Span from a given start position to a given end position.

Since: 0.1.0

spanPath :: Lens' Span (Maybe Path) Source #

A lens into the (nullable) path associated with a Span.

Since: 0.1.0

spanRange :: Lens' Span (Offset, Offset) Source #

A lens giving the start and end Offsets associated with a Span.

Since: 0.1.0

spanStart :: Lens' Span Offset Source #

A lens into the Offset associated with the start of a Span.

Since: 0.1.0

spanEnd :: Lens' Span Offset Source #

A lens into the Offset associated with the end of a Span.

Since: 0.1.0

data Position Source #

This datatype represents the position of a cursor in a text file.

Since: 0.1.0

Instances

Eq Position Source # 
Show Position Source # 
Generic Position Source # 

Associated Types

type Rep Position :: * -> * #

Methods

from :: Position -> Rep Position x #

to :: Rep Position x -> Position #

Hashable Position Source #

Default Hashable instance via Generic.

Since: 0.1.0

Methods

hashWithSalt :: Int -> Position -> Int #

hash :: Position -> Int #

ToJSON Position Source #

Converts to {file: …, line: …, col: …}.

Since: 0.1.0

FromJSON Position Source #

Inverse of the ToJSON instance.

Since: 0.1.0

NFData Position Source #

Default NFData instance via Generic.

Since: 0.1.0

Methods

rnf :: Position -> () #

(Monad m, Serial m Text) => Serial m Position Source #

Default Serial instance via Generic.

Since: 0.1.0

Methods

series :: Series m Position #

(Monad m, CoSerial m Text) => CoSerial m Position Source #

Default CoSerial instance via Generic.

Since: 0.1.0

Methods

coseries :: Series m b -> Series m (Position -> b) #

type Rep Position Source # 
type Rep Position = D1 (MetaData "Position" "Language.Ninja.Misc.Located" "language-ninja-0.1.0-CTXTL0Lugm4Llo91nN4SIr" False) (C1 (MetaCons "MkPosition" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_positionFile") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Path))) ((:*:) (S1 (MetaSel (Just Symbol "_positionLine") SourceUnpack SourceStrict DecidedUnpack) (Rec0 Line)) (S1 (MetaSel (Just Symbol "_positionCol") SourceUnpack SourceStrict DecidedUnpack) (Rec0 Column)))))

makePosition :: Maybe Path -> Offset -> Position Source #

Construct a Position from a (nullable) path and a (line, column) pair.

Since: 0.1.0

positionFile :: Lens' Position (Maybe Path) Source #

The path of the file pointed to by this position, if any.

Since: 0.1.0

positionOffset :: Lens' Position Offset Source #

The offset in the file pointed to by this position.

Since: 0.1.0

positionLine :: Lens' Position Line Source #

The line number in the file pointed to by this position.

Since: 0.1.0

positionCol :: Lens' Position Column Source #

The column number in the line pointed to by this position.

Since: 0.1.0

comparePosition :: Position -> Position -> Maybe Ordering Source #

If two Positions are comparable (i.e.: if they are in the same file), this function will return an Ordering giving their relative positions. Otherwise, it will of course return Nothing.

Since: 0.1.0

type Offset = (Line, Column) Source #

A line/column offset into a file.

Since: 0.1.0

compareOffset :: Offset -> Offset -> Ordering Source #

Compare two Offsets in lexicographic order (i.e.: the Column is ignored unless they are on the same Line).

Since: 0.1.0

offsetLine :: Lens' Offset Line Source #

A lens into the Line associated with an Offset.

For now, this is simply defined as offsetLine = _1, but if Offset is later refactored to be an abstract data type, using this lens instead of _1 will decrease the amount of code that breaks.

Since: 0.1.0

offsetColumn :: Lens' Offset Column Source #

A lens into the Line associated with an Offset.

Read the description of offsetLine for an understanding of why this exists and why you should use it instead of _2.

Since: 0.1.0

type Line = Int Source #

A line number.

Since: 0.1.0

type Column = Int Source #

A column number.

Since: 0.1.0