Safe Haskell  None 

Language  Haskell2010 
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
 data SpanUpdate = SpanUpdate {}
 data SrcSpan = SrcSpan {}
 data SourcePos = SourcePos {
 sourceName :: FilePath
 sourceLine :: !Pos
 sourceColumn :: !Pos
 updateSpan :: SpanUpdate > Text > Text
 updateSpans :: [SpanUpdate] > Text > Text
 linearizeSourcePos :: Text > Int64 > Int64 > Int64
 prettyPrintSourcePos :: SourcePos > String
 split :: SourcePos > Text > (Text, Text)
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 #  
Defined in Update.Span 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 #  
Defined in Update.Span showsPrec :: Int > SpanUpdate > ShowS # show :: SpanUpdate > String # showList :: [SpanUpdate] > ShowS # 
A location in a source file
Instances
Eq SrcSpan  
Data SrcSpan  
Defined in Nix.Expr.Types.Annotated gfoldl :: (forall d b. Data d => c (d > b) > d > c b) > (forall g. g > c g) > SrcSpan > c SrcSpan # gunfold :: (forall b r. Data b => c (b > r) > c r) > (forall r. r > c r) > Constr > c SrcSpan # toConstr :: SrcSpan > Constr # dataTypeOf :: SrcSpan > DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) > Maybe (c SrcSpan) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) > Maybe (c SrcSpan) # gmapT :: (forall b. Data b => b > b) > SrcSpan > SrcSpan # gmapQl :: (r > r' > r) > r > (forall d. Data d => d > r') > SrcSpan > r # gmapQr :: (r' > r > r) > r > (forall d. Data d => d > r') > SrcSpan > r # gmapQ :: (forall d. Data d => d > u) > SrcSpan > [u] # gmapQi :: Int > (forall d. Data d => d > u) > SrcSpan > u # gmapM :: Monad m => (forall d. Data d => d > m d) > SrcSpan > m SrcSpan # gmapMp :: MonadPlus m => (forall d. Data d => d > m d) > SrcSpan > m SrcSpan # gmapMo :: MonadPlus m => (forall d. Data d => d > m d) > SrcSpan > m SrcSpan #  
Ord SrcSpan  
Show SrcSpan  
Generic SrcSpan  
Semigroup SrcSpan  
Hashable SrcSpan  
Defined in Nix.Expr.Types.Annotated  
ToJSON SrcSpan  
Defined in Nix.Expr.Types.Annotated  
FromJSON SrcSpan  
Binary NExprLoc  
Binary SrcSpan  
NFData SrcSpan  
Defined in Nix.Expr.Types.Annotated  
Serialise NExprLoc  
Serialise SrcSpan  
Monad m => Scoped NExprLoc (Reducer m)  
Defined in Nix.Reduce currentScopes :: Reducer m (Scopes (Reducer m) NExprLoc) # clearScopes :: Reducer m r > Reducer m r # pushScopes :: Scopes (Reducer m) NExprLoc > Reducer m r > Reducer m r #  
Binary r => Binary (NExprLocF r)  
Monad m => MonadReader (Maybe FilePath, Scopes (Reducer m) NExprLoc) (Reducer m)  
Defined in Nix.Reduce  
Monad m => MonadState (HashMap FilePath NExprLoc) (Reducer m)  
Serialise r => Serialise (Compose (Ann SrcSpan) NExprF r)  
type Rep SrcSpan  
Defined in Nix.Expr.Types.Annotated type Rep SrcSpan = D1 (MetaData "SrcSpan" "Nix.Expr.Types.Annotated" "hnix0.10.1A5i0yy7up1D9FGLDeU5IEN" False) (C1 (MetaCons "SrcSpan" PrefixI True) (S1 (MetaSel (Just "spanBegin") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourcePos) :*: S1 (MetaSel (Just "spanEnd") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourcePos))) 
The data type SourcePos
represents source positions. It contains the
name of the source file, a line number, and a column number. Source line
and column positions change intensively during parsing, so we need to
make them strict to avoid memory leaks.
SourcePos  

Instances
Eq SourcePos  
Data SourcePos  
Defined in Text.Megaparsec.Pos 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  
Defined in Text.Megaparsec.Pos  
Read SourcePos  
Show SourcePos  
Generic SourcePos  
NFData SourcePos  
Defined in Text.Megaparsec.Pos  
type Rep SourcePos  
Defined in Text.Megaparsec.Pos type Rep SourcePos = D1 (MetaData "SourcePos" "Text.Megaparsec.Pos" "megaparsec9.0.0CRKRRSoqPia7uOlYeDVII9" False) (C1 (MetaCons "SourcePos" PrefixI True) (S1 (MetaSel (Just "sourceName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 FilePath) :*: (S1 (MetaSel (Just "sourceLine") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Pos) :*: S1 (MetaSel (Just "sourceColumn") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Pos)))) 
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 nonoverlapping.