update-nix-fetchgit-0.1.0.0: A program to update fetchgit values in Nix expressions

Safe HaskellSafe
LanguageHaskell2010

Update.Span

Description

This module deals with updating spans of characters in values of type Text.

It defines some helper types and functions to apply these "updates".

Synopsis

Documentation

data SpanUpdate Source #

A span and some text to replace it with. They don't have to be the same length.

Instances

Data SpanUpdate Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SpanUpdate -> c SpanUpdate #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SpanUpdate #

toConstr :: SpanUpdate -> Constr #

dataTypeOf :: SpanUpdate -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c SpanUpdate) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SpanUpdate) #

gmapT :: (forall b. Data b => b -> b) -> SpanUpdate -> SpanUpdate #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SpanUpdate -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SpanUpdate -> r #

gmapQ :: (forall d. Data d => d -> u) -> SpanUpdate -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SpanUpdate -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SpanUpdate -> m SpanUpdate #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SpanUpdate -> m SpanUpdate #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SpanUpdate -> m SpanUpdate #

Show SpanUpdate Source # 

data SourcePos Source #

A position in a text file

Constructors

SourcePos 

Instances

Eq SourcePos Source # 
Data SourcePos Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SourcePos -> c SourcePos #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SourcePos #

toConstr :: SourcePos -> Constr #

dataTypeOf :: SourcePos -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c SourcePos) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SourcePos) #

gmapT :: (forall b. Data b => b -> b) -> SourcePos -> SourcePos #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r #

gmapQ :: (forall d. Data d => d -> u) -> SourcePos -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SourcePos -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos #

Ord SourcePos Source # 
Show SourcePos Source # 

data SourceSpan Source #

A span of characters with a beginning and an end.

spanEnd must be greater than spanBegin

Instances

Data SourceSpan Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SourceSpan -> c SourceSpan #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SourceSpan #

toConstr :: SourceSpan -> Constr #

dataTypeOf :: SourceSpan -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c SourceSpan) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SourceSpan) #

gmapT :: (forall b. Data b => b -> b) -> SourceSpan -> SourceSpan #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SourceSpan -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SourceSpan -> r #

gmapQ :: (forall d. Data d => d -> u) -> SourceSpan -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SourceSpan -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SourceSpan -> m SourceSpan #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SourceSpan -> m SourceSpan #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SourceSpan -> m SourceSpan #

Show SourceSpan Source # 

updateSpan :: SpanUpdate -> Text -> Text Source #

Update a single span of characters inside a text value. If you're updating multiples spans it's best to use updateSpans.

updateSpans :: [SpanUpdate] -> Text -> Text Source #

Update many spans in a file. They must be non-overlapping.

linearizeSourcePos Source #

Arguments

:: Text

The string to linearize in

-> Int64

The line offset

-> Int64

The column offset

-> Int64

The character offset

Go from a line and column representation to a single character offset from the beginning of the text.

This probably fails on crazy texts with multi character line breaks.