-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Source location helpers -- -- Types and functions for working with location-tagged tokens. Includes -- an implementation of the offsides-rule, to make adding layout to a -- compiler an easy task. @package located @version 0.1.1.0 module Text.Location data Position Position :: !Int64 -> Position [posRow, posCol] :: Position -> !Int64 data Range source Range :: Maybe source -> !Position -> Range source [rangeSource] :: Range source -> Maybe source [rangeStart, rangeEnd] :: Range source -> !Position data Located source a Located :: !(Range source) -> a -> Located source a [locRange] :: Located source a -> !(Range source) [locValue] :: Located source a -> a -- | Remove one layer of location information. class UnLoc a unLoc :: UnLoc a => a -> a class HasLoc a where type LocSource a :: * where { type family LocSource a :: *; } getLoc :: HasLoc a => a -> Range (LocSource a) at :: HasLoc loc => a -> loc -> Located (LocSource loc) a thing :: Located source a -> a -- | Move a position by the width of a character. movePos :: Int64 -> Char -> Position -> Position inRange :: Range source -> Position -> Bool zeroPos :: Position -- | The lines that the region describes, with optional additional lines of -- context. rangeText :: Int -> Range source -> Text -> Text instance GHC.Generics.Generic (Text.Location.Located source a) instance (GHC.Show.Show source, GHC.Show.Show a) => GHC.Show.Show (Text.Location.Located source a) instance Data.Traversable.Traversable (Text.Location.Located source) instance Data.Foldable.Foldable (Text.Location.Located source) instance GHC.Base.Functor (Text.Location.Located source) instance GHC.Generics.Generic (Text.Location.Range source) instance GHC.Classes.Ord source => GHC.Classes.Ord (Text.Location.Range source) instance GHC.Classes.Eq source => GHC.Classes.Eq (Text.Location.Range source) instance GHC.Show.Show source => GHC.Show.Show (Text.Location.Range source) instance GHC.Generics.Generic Text.Location.Position instance GHC.Classes.Ord Text.Location.Position instance GHC.Classes.Eq Text.Location.Position instance GHC.Show.Show Text.Location.Position instance GHC.Classes.Eq source => GHC.Classes.Eq (Text.Location.Located source a) instance GHC.Classes.Ord source => GHC.Classes.Ord (Text.Location.Located source a) instance Text.Location.UnLoc a => Text.Location.UnLoc (Text.Location.Located source a) instance Text.Location.UnLoc a => Text.Location.UnLoc [a] instance Text.Location.UnLoc a => Text.Location.UnLoc (GHC.Base.Maybe a) instance Text.Location.HasLoc a => Text.Location.HasLoc (GHC.Base.Maybe a) instance Text.Location.HasLoc a => Text.Location.HasLoc [a] instance (Text.Location.LocSource a ~ Text.Location.LocSource b, Text.Location.HasLoc a, Text.Location.HasLoc b) => Text.Location.HasLoc (a, b) instance (Text.Location.LocSource a ~ Text.Location.LocSource b, Text.Location.LocSource b ~ Text.Location.LocSource c, Text.Location.HasLoc a, Text.Location.HasLoc b, Text.Location.HasLoc c) => Text.Location.HasLoc (a, b, c) instance (Text.Location.LocSource a ~ Text.Location.LocSource b, Text.Location.LocSource b ~ Text.Location.LocSource c, Text.Location.LocSource c ~ Text.Location.LocSource d, Text.Location.HasLoc a, Text.Location.HasLoc b, Text.Location.HasLoc c, Text.Location.HasLoc d) => Text.Location.HasLoc (a, b, c, d) instance Text.Location.HasLoc (Text.Location.Range source) instance Text.Location.HasLoc (Text.Location.Located source a) instance GHC.Base.Monoid (Text.Location.Range source) module Text.Location.Layout data Layout a Layout :: (a -> Bool) -> (a -> Bool) -> a -> a -> a -> Layout a -- | True when this token begins layout [beginsLayout] :: Layout a -> a -> Bool -- | True when this token explicitly ends layout [endsLayout] :: Layout a -> a -> Bool -- | The separator token [sep] :: Layout a -> a -- | Layout block starting token [start] :: Layout a -> a -- | Layout block ending token [end] :: Layout a -> a layout :: Layout a -> [Located source a] -> [Located source a]