-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Types and functionality for working with source code -- -- Types and functionality for working with source code (program text). @package semantic-source @version 0.0.2.0 module Source.Language -- | The various languages we support. data Language Unknown :: Language Go :: Language Haskell :: Language Java :: Language JavaScript :: Language JSON :: Language JSX :: Language Markdown :: Language Python :: Language Ruby :: Language TypeScript :: Language PHP :: Language TSX :: Language -- | Reifies a proxied type-level Language to a value. class SLanguage (lang :: Language) reflect :: SLanguage lang => proxy lang -> Language extensionsForLanguage :: Language -> [String] -- | Predicate failing on Unknown and passing in all other cases. knownLanguage :: Language -> Bool forPath :: AbsRel ar => File ar -> Language textToLanguage :: Text -> Language languageToText :: Language -> Text instance GHC.Enum.Enum Source.Language.Language instance Data.Aeson.Types.ToJSON.ToJSON Source.Language.Language instance Data.Hashable.Class.Hashable Source.Language.Language instance GHC.Enum.Bounded Source.Language.Language instance GHC.Show.Show Source.Language.Language instance GHC.Read.Read Source.Language.Language instance GHC.Classes.Ord Source.Language.Language instance GHC.Generics.Generic Source.Language.Language instance GHC.Classes.Eq Source.Language.Language instance Source.Language.SLanguage 'Source.Language.Unknown instance Source.Language.SLanguage 'Source.Language.Go instance Source.Language.SLanguage 'Source.Language.Haskell instance Source.Language.SLanguage 'Source.Language.Java instance Source.Language.SLanguage 'Source.Language.JavaScript instance Source.Language.SLanguage 'Source.Language.JSON instance Source.Language.SLanguage 'Source.Language.JSX instance Source.Language.SLanguage 'Source.Language.Markdown instance Source.Language.SLanguage 'Source.Language.Python instance Source.Language.SLanguage 'Source.Language.Ruby instance Source.Language.SLanguage 'Source.Language.TypeScript instance Source.Language.SLanguage 'Source.Language.PHP instance Data.Aeson.Types.FromJSON.FromJSON Source.Language.Language module Source.Range -- | A 0-indexed, half-open interval of integers, defined by start & -- end indices. data Range Range :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> Range [start] :: Range -> {-# UNPACK #-} !Int [end] :: Range -> {-# UNPACK #-} !Int -- | Construct a Range with a given value for both its start and end -- indices. point :: Int -> Range -- | Return the length of the range. rangeLength :: Range -> Int subtractRange :: Range -> Range -> Range start_ :: Lens' Range Int end_ :: Lens' Range Int instance GHC.Show.Show Source.Range.Range instance GHC.Classes.Ord Source.Range.Range instance GHC.Generics.Generic Source.Range.Range instance GHC.Classes.Eq Source.Range.Range instance Data.Hashable.Class.Hashable Source.Range.Range instance Control.DeepSeq.NFData Source.Range.Range instance GHC.Base.Semigroup Source.Range.Range instance Data.Semilattice.Lower.Lower Source.Range.Range instance Data.Aeson.Types.ToJSON.ToJSON Source.Range.Range -- | Source position and span information -- -- Mostly taken from purescript's SourcePos definition. module Source.Span -- | A Span of position information data Span Span :: {-# UNPACK #-} !Pos -> {-# UNPACK #-} !Pos -> Span [start] :: Span -> {-# UNPACK #-} !Pos [end] :: Span -> {-# UNPACK #-} !Pos -- | Construct a Span with a given value for both its start and end -- positions. point :: Pos -> Span spanFromSrcLoc :: SrcLoc -> Span -- | Source position information (1-indexed) data Pos Pos :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> Pos [line] :: Pos -> {-# UNPACK #-} !Int [column] :: Pos -> {-# UNPACK #-} !Int line_ :: Lens' Pos Int column_ :: Lens' Pos Int -- | "Classy-fields" interface for data types that have spans. class HasSpan a span_ :: HasSpan a => Lens' a Span start_ :: HasSpan a => Lens' a Pos end_ :: HasSpan a => Lens' a Pos instance GHC.Show.Show Source.Span.Span instance GHC.Generics.Generic Source.Span.Span instance GHC.Classes.Ord Source.Span.Span instance GHC.Classes.Eq Source.Span.Span instance GHC.Show.Show Source.Span.Pos instance GHC.Generics.Generic Source.Span.Pos instance GHC.Classes.Ord Source.Span.Pos instance GHC.Classes.Eq Source.Span.Pos instance Source.Span.HasSpan Source.Span.Span instance Data.Hashable.Class.Hashable Source.Span.Span instance Control.DeepSeq.NFData Source.Span.Span instance GHC.Base.Semigroup Source.Span.Span instance Data.Aeson.Types.ToJSON.ToJSON Source.Span.Span instance Data.Aeson.Types.FromJSON.FromJSON Source.Span.Span instance Data.Semilattice.Lower.Lower Source.Span.Span instance Data.Hashable.Class.Hashable Source.Span.Pos instance Control.DeepSeq.NFData Source.Span.Pos instance Data.Aeson.Types.ToJSON.ToJSON Source.Span.Pos instance Data.Aeson.Types.FromJSON.FromJSON Source.Span.Pos instance Data.Semilattice.Lower.Lower Source.Span.Pos -- | Source models source code, represented as a thin wrapper around -- a ByteString with conveniences for splitting by line, slicing, -- etc. -- -- This module is intended to be imported qualified to avoid name clashes -- with Prelude: -- --
-- import qualified Source.Source as Source --module Source.Source -- | The contents of a source file. This is represented as a UTF-8 -- ByteString under the hood. Construct these with -- fromUTF8; obviously, passing fromUTF8 non-UTF8 bytes -- will cause crashes. data Source bytes :: Source -> ByteString fromUTF8 :: ByteString -> Source length :: Source -> Int null :: Source -> Bool -- | Return a Range that covers the entire text. totalRange :: Source -> Range -- | Return a Span that covers the entire text. totalSpan :: Source -> Span -- | Return a Source from a Text. fromText :: Text -> Source -- | Return the Text contained in the Source. toText :: Source -> Text -- | Return a Source that contains a slice of the given -- Source. slice :: Source -> Range -> Source drop :: Int -> Source -> Source take :: Int -> Source -> Source -- | Split the contents of the source after newlines. lines :: Source -> [Source] -- | Compute the Ranges of each line in a Source. lineRanges :: Source -> [Range] -- | Compute the Ranges of each line in a Range of a -- Source. lineRangesWithin :: Source -> Range -> [Range] -- | Return all indices of newlines ('n', 'r', and 'rn') in the -- ByteString. newlineIndices :: ByteString -> [Int] instance Control.DeepSeq.NFData Source.Source.Source instance GHC.Generics.Generic Source.Source.Source instance GHC.Show.Show Source.Source.Source instance Data.String.IsString Source.Source.Source instance GHC.Base.Monoid Source.Source.Source instance GHC.Base.Semigroup Source.Source.Source instance GHC.Classes.Eq Source.Source.Source instance Data.Aeson.Types.FromJSON.FromJSON Source.Source.Source module Source.Loc data Loc Loc :: {-# UNPACK #-} !Range -> {-# UNPACK #-} !Span -> Loc [byteRange] :: Loc -> {-# UNPACK #-} !Range [span] :: Loc -> {-# UNPACK #-} !Span byteRange_ :: Lens' Loc Range -- | A Span of position information data Span Span :: {-# UNPACK #-} !Pos -> {-# UNPACK #-} !Pos -> Span -- | A 0-indexed, half-open interval of integers, defined by start & -- end indices. data Range Range :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> Range instance GHC.Base.Semigroup Source.Loc.Loc instance GHC.Generics.Generic Source.Loc.Loc instance GHC.Show.Show Source.Loc.Loc instance GHC.Classes.Ord Source.Loc.Loc instance GHC.Classes.Eq Source.Loc.Loc instance Data.Hashable.Class.Hashable Source.Loc.Loc instance Control.DeepSeq.NFData Source.Loc.Loc instance Source.Span.HasSpan Source.Loc.Loc instance Data.Aeson.Types.ToJSON.ToJSON Source.Loc.Loc