Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This modules provides data types that describe line-column locations within a text.
Synopsis
- class HasLoc α where
- class HasLoc α => LocLens α where
- data Span l = Span l l
- class SpannedLoc l where
- locStart :: SpannedLoc l => l -> SpanLoc l
- locEnd :: SpannedLoc l => l -> SpanLoc l
- spanOf :: (HasLoc α, SpannedLoc (LocOf α)) => α -> Span (SpanLoc (LocOf α))
- startOf :: (HasLoc α, SpannedLoc (LocOf α)) => α -> SpanLoc (LocOf α)
- endOf :: (HasLoc α, SpannedLoc (LocOf α)) => α -> SpanLoc (LocOf α)
- class SpannedLoc l => SpannedLens l where
- lStart :: (Functor f, SpannedLens l) => (SpanLoc l -> f (SpanLoc l)) -> l -> f l
- lEnd :: (Functor f, SpannedLens l) => (SpanLoc l -> f (SpanLoc l)) -> l -> f l
- lSpanOf :: (Functor f, LocLens α, SpannedLens (LocOf α)) => (Span (SpanLoc (LocOf α)) -> f (Span (SpanLoc (LocOf α)))) -> α -> f α
- lEndOf :: (Functor f, LocLens α, SpannedLens (LocOf α)) => (SpanLoc (LocOf α) -> f (SpanLoc (LocOf α))) -> α -> f α
- lStartOf :: (Functor f, LocLens α, SpannedLens (LocOf α)) => (SpanLoc (LocOf α) -> f (SpanLoc (LocOf α))) -> α -> f α
- data Located l α = Located {}
- data LineCol = LineCol !Word !Word
- nextLine :: LineCol -> LineCol
- nextCol :: LineCol -> LineCol
- class LineColLoc l where
- locLineCol :: l -> LineCol
- locLine :: LineColLoc l => l -> Word
- locCol :: LineColLoc l => l -> Word
- lineColOf :: (HasLoc α, LineColLoc (LocOf α)) => α -> LineCol
- lineOf :: (HasLoc α, LineColLoc (LocOf α)) => α -> Word
- colOf :: (HasLoc α, LineColLoc (LocOf α)) => α -> Word
- class LineColLens l where
- lLine :: (Functor f, LineColLens l) => (Word -> f Word) -> l -> f l
- lCol :: (Functor f, LineColLens l) => (Word -> f Word) -> l -> f l
- lLineColOf :: (Functor f, LocLens α, LineColLens (LocOf α)) => (LineCol -> f LineCol) -> α -> f α
- lLineOf :: (Functor f, LocLens α, LineColLens (LocOf α)) => (Word -> f Word) -> α -> f α
- lColOf :: (Functor f, LocLens α, LineColLens (LocOf α)) => (Word -> f Word) -> α -> f α
- class SrcLoc l where
- srcOf :: (HasLoc α, SrcLoc (LocOf α)) => α -> LocSrc (LocOf α)
- class SrcLoc l => SrcLens l where
- lSrcOf :: (Functor f, LocLens α, SrcLens (LocOf α)) => (LocSrc (LocOf α) -> f (LocSrc (LocOf α))) -> α -> f α
- data InSrc s l = InSrc {}
- class FromLoc l where
- fromOf :: (HasLoc α, FromLoc (LocOf α)) => α -> LocFrom (LocOf α)
- class FromLoc l => FromLens l where
- lFromOf :: (Functor f, LocLens α, FromLens (LocOf α)) => (LocFrom (LocOf α) -> f (LocFrom (LocOf α))) -> α -> f α
- data Nested l p = Nested {
- nestedLoc :: l
- nestedFrom :: p
Documentation
Values with associated source locations.
class HasLoc α => LocLens α where Source #
Values with editable associated source locations.
A region of text between two locations.
Span l l |
Instances
class SpannedLoc l where Source #
Spanned locations.
Instances
SpannedLoc (Span l) Source # | |
SpannedLoc l => SpannedLoc (InSrc s l) Source # | |
SpannedLoc l => SpannedLoc (Nested l p) Source # | |
locStart :: SpannedLoc l => l -> SpanLoc l Source #
The start of a span.
locEnd :: SpannedLoc l => l -> SpanLoc l Source #
The end of a span.
spanOf :: (HasLoc α, SpannedLoc (LocOf α)) => α -> Span (SpanLoc (LocOf α)) Source #
The span of the associated location.
startOf :: (HasLoc α, SpannedLoc (LocOf α)) => α -> SpanLoc (LocOf α) Source #
The start of the associated location.
endOf :: (HasLoc α, SpannedLoc (LocOf α)) => α -> SpanLoc (LocOf α) Source #
The end of the associated location.
class SpannedLoc l => SpannedLens l where Source #
Editable spanned locations.
Instances
SpannedLens (Span l) Source # | |
SpannedLens l => SpannedLens (InSrc s l) Source # | |
SpannedLens l => SpannedLens (Nested l p) Source # | |
lStart :: (Functor f, SpannedLens l) => (SpanLoc l -> f (SpanLoc l)) -> l -> f l Source #
Provides access to the start of a location.
lEnd :: (Functor f, SpannedLens l) => (SpanLoc l -> f (SpanLoc l)) -> l -> f l Source #
Provides access to the end of a location.
lSpanOf :: (Functor f, LocLens α, SpannedLens (LocOf α)) => (Span (SpanLoc (LocOf α)) -> f (Span (SpanLoc (LocOf α)))) -> α -> f α Source #
Provides access to the span of the associated location.
lEndOf :: (Functor f, LocLens α, SpannedLens (LocOf α)) => (SpanLoc (LocOf α) -> f (SpanLoc (LocOf α))) -> α -> f α Source #
Provides access to the end of the associated location.
lStartOf :: (Functor f, LocLens α, SpannedLens (LocOf α)) => (SpanLoc (LocOf α) -> f (SpanLoc (LocOf α))) -> α -> f α Source #
Provides access to the start of the associated location.
A simple way to attach location to a value.
Instances
Foldable (Located l) Source # | |
Defined in Text.Loc fold :: Monoid m => Located l m -> m # foldMap :: Monoid m => (a -> m) -> Located l a -> m # foldMap' :: Monoid m => (a -> m) -> Located l a -> m # foldr :: (a -> b -> b) -> b -> Located l a -> b # foldr' :: (a -> b -> b) -> b -> Located l a -> b # foldl :: (b -> a -> b) -> b -> Located l a -> b # foldl' :: (b -> a -> b) -> b -> Located l a -> b # foldr1 :: (a -> a -> a) -> Located l a -> a # foldl1 :: (a -> a -> a) -> Located l a -> a # toList :: Located l a -> [a] # length :: Located l a -> Int # elem :: Eq a => a -> Located l a -> Bool # maximum :: Ord a => Located l a -> a # minimum :: Ord a => Located l a -> a # | |
Traversable (Located l) Source # | |
Functor (Located l) Source # | |
Generic (Located l α) Source # | |
(Read l, Read α) => Read (Located l α) Source # | |
(Show l, Show α) => Show (Located l α) Source # | |
(Eq l, Eq α) => Eq (Located l α) Source # | |
(Hashable l, Hashable α) => Hashable (Located l α) Source # | |
HasLoc (Located l α) Source # | |
LocLens (Located l α) Source # | |
type Rep (Located l α) Source # | |
Defined in Text.Loc type Rep (Located l α) = D1 ('MetaData "Located" "Text.Loc" "text-loc-0.1.1-GlWx6SfF9Kx4Cq6FohOQm8" 'False) (C1 ('MetaCons "Located" 'PrefixI 'True) (S1 ('MetaSel ('Just "locAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 l) :*: S1 ('MetaSel ('Just "locVal") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 α))) | |
type LocOf (Located l α) Source # | |
Line-column location within a text.
Instances
Bounded LineCol Source # | |
Generic LineCol Source # | |
Read LineCol Source # | |
Show LineCol Source # | |
Eq LineCol Source # | |
Ord LineCol Source # | |
Hashable LineCol Source # | |
HasLoc LineCol Source # | |
LineColLens LineCol Source # | |
LineColLoc LineCol Source # | |
type Rep LineCol Source # | |
Defined in Text.Loc type Rep LineCol = D1 ('MetaData "LineCol" "Text.Loc" "text-loc-0.1.1-GlWx6SfF9Kx4Cq6FohOQm8" 'False) (C1 ('MetaCons "LineCol" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word))) | |
type LocOf LineCol Source # | |
class LineColLoc l where Source #
Locations with line and column numbers.
locLineCol :: l -> LineCol Source #
Instances
LineColLoc LineCol Source # | |
LineColLoc l => LineColLoc (InSrc s l) Source # | |
LineColLoc l => LineColLoc (Nested l p) Source # | |
locLine :: LineColLoc l => l -> Word Source #
The line number of a location.
locCol :: LineColLoc l => l -> Word Source #
The column number of a location.
lineColOf :: (HasLoc α, LineColLoc (LocOf α)) => α -> LineCol Source #
The line-column numbers of the associated location.
lineOf :: (HasLoc α, LineColLoc (LocOf α)) => α -> Word Source #
The line number of the associated location.
colOf :: (HasLoc α, LineColLoc (LocOf α)) => α -> Word Source #
The column number of the associated location.
class LineColLens l where Source #
Locations with editable line and column numbers.
Instances
LineColLens LineCol Source # | |
LineColLens l => LineColLens (InSrc s l) Source # | |
LineColLens l => LineColLens (Nested l p) Source # | |
lLine :: (Functor f, LineColLens l) => (Word -> f Word) -> l -> f l Source #
Provides access to the line number of a location.
lCol :: (Functor f, LineColLens l) => (Word -> f Word) -> l -> f l Source #
Provides access to the column number of a location.
lLineColOf :: (Functor f, LocLens α, LineColLens (LocOf α)) => (LineCol -> f LineCol) -> α -> f α Source #
Provides access to the line-column numbers of the associated location.
lLineOf :: (Functor f, LocLens α, LineColLens (LocOf α)) => (Word -> f Word) -> α -> f α Source #
Provides access to the line number of the associated location.
lColOf :: (Functor f, LocLens α, LineColLens (LocOf α)) => (Word -> f Word) -> α -> f α Source #
Provides access to the column number of the associated location.
Locations with a source (e.g. file name).
srcOf :: (HasLoc α, SrcLoc (LocOf α)) => α -> LocSrc (LocOf α) Source #
The source of the associated location.
class SrcLoc l => SrcLens l where Source #
Locations with editable source (e.g. file name).
lSrcOf :: (Functor f, LocLens α, SrcLens (LocOf α)) => (LocSrc (LocOf α) -> f (LocSrc (LocOf α))) -> α -> f α Source #
Provides access to the source of the associated location.
A simple way to add source to a location.
Instances
fromOf :: (HasLoc α, FromLoc (LocOf α)) => α -> LocFrom (LocOf α) Source #
The parent of the associated location.
class FromLoc l => FromLens l where Source #
Locations with editable parent locations.
lFromOf :: (Functor f, LocLens α, FromLens (LocOf α)) => (LocFrom (LocOf α) -> f (LocFrom (LocOf α))) -> α -> f α Source #
Provides access to the parent of the associated location.
A simple way to nest a location.
Nested | |
|