-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A modern parser combinator library with convenient diagnostics
--   
--   A modern parser combinator library with slicing and Clang-style
--   colored diagnostics
@package trifecta
@version 1.6.2.1


-- | Johan Tibell 2011 License : BSD3
--   
--   Maintainer : ekmett@gmail.com Stability : experimental Portability :
--   unknown
--   
--   Fast zero based arrays, based on the implementation in the HAMT-branch
--   of unordered-containers
module Text.Trifecta.Util.Array
data Array a
data MArray s a

-- | Create a new mutable array of specified size, in the specified state
--   thread, with each element containing the specified initial value.
new :: Int -> a -> ST s (MArray s a)
new_ :: Int -> ST s (MArray s a)
empty :: Array a
singleton :: a -> Array a
length :: Array a -> Int
lengthM :: MArray s a -> Int
read :: MArray s a -> Int -> ST s a
write :: MArray s a -> Int -> a -> ST s ()
index :: Array a -> Int -> a
index_ :: Array a -> Int -> ST s a
indexM_ :: MArray s a -> Int -> ST s a

-- | <i>O(n)</i> Update the element at the given position in this array.
update :: Array e -> Int -> e -> Array e

-- | <i>O(n)</i> Insert an element at the given position in this array,
--   increasing its size by one.
insert :: Array e -> Int -> e -> Array e

-- | <i>O(n)</i> Delete an element at the given position in this array,
--   decreasing its size by one.
delete :: Array e -> Int -> Array e
unsafeFreeze :: MArray s a -> ST s (Array a)
run :: (forall s. ST s (MArray s e)) -> Array e
run2 :: (forall s. ST s (MArray s e, a)) -> (Array e, a)

-- | Unsafely copy the elements of an array. Array bounds are not checked.
copy :: Array e -> Int -> MArray s e -> Int -> Int -> ST s ()

-- | Unsafely copy the elements of an array. Array bounds are not checked.
copyM :: MArray s e -> Int -> MArray s e -> Int -> Int -> ST s ()
foldl' :: (b -> a -> b) -> b -> Array a -> b
foldr :: (a -> b -> b) -> b -> Array a -> b
thaw :: Array e -> Int -> Int -> ST s (MArray s e)
map :: (a -> b) -> Array a -> Array b

-- | Strict version of <a>map</a>.
map' :: (a -> b) -> Array a -> Array b
traverse :: Applicative f => (a -> f b) -> Array a -> f (Array b)
filter :: (a -> Bool) -> Array a -> Array a
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Text.Trifecta.Util.Array.Array a)


-- | Interval maps implemented using the <a>FingerTree</a> type, following
--   section 4.8 of
--   
--   <ul>
--   <li>Ralf Hinze and Ross Paterson, "Finger trees: a simple
--   general-purpose data structure", <i>Journal of Functional
--   Programming</i> 16:2 (2006) pp 197-217.
--   <a>http://www.soi.city.ac.uk/~ross/papers/FingerTree.html</a></li>
--   </ul>
--   
--   An amortized running time is given for each operation, with <i>n</i>
--   referring to the size of the priority queue. These bounds hold even in
--   a persistent (shared) setting.
--   
--   <i>Note</i>: Many of these operations have the same names as similar
--   operations on lists in the <a>Prelude</a>. The ambiguity may be
--   resolved using either qualification or the <tt>hiding</tt> clause.
--   
--   Unlike <a>Data.IntervalMap.FingerTree</a>, this version sorts things
--   so that the largest interval from a given point comes first. This way
--   if you have nested intervals, you get the outermost interval before
--   the contained intervals.
module Text.Trifecta.Util.IntervalMap

-- | A closed interval. The lower bound should be less than or equal to the
--   higher bound.
data Interval v
Interval :: v -> v -> Interval v
[low] :: Interval v -> v
[high] :: Interval v -> v

-- | Map of closed intervals, possibly with duplicates. The <a>Foldable</a>
--   and <a>Traversable</a> instances process the intervals in
--   lexicographical order.
newtype IntervalMap v a
IntervalMap :: FingerTree (IntInterval v) (Node v a) -> IntervalMap v a
[runIntervalMap] :: IntervalMap v a -> FingerTree (IntInterval v) (Node v a)

-- | <i>O(1)</i>. Interval map with a single entry.
singleton :: Ord v => Interval v -> a -> IntervalMap v a

-- | <i>O(log n)</i>. Insert an interval into a map. The map may contain
--   duplicate intervals; the new entry will be inserted before any
--   existing entries for the same interval.
insert :: Ord v => v -> v -> a -> IntervalMap v a -> IntervalMap v a

-- | <i>O(k log (n</i>/<i>k))</i>. All intervals that contain the given
--   point, in lexicographical order.
search :: Ord v => v -> IntervalMap v a -> [(Interval v, a)]

-- | <i>O(k log (n</i>/<i>k))</i>. All intervals that intersect with the
--   given interval, in lexicographical order.
intersections :: Ord v => v -> v -> IntervalMap v a -> [(Interval v, a)]

-- | <i>O(k log (n</i>/<i>k))</i>. All intervals that contain the given
--   interval, in lexicographical order.
dominators :: Ord v => v -> v -> IntervalMap v a -> [(Interval v, a)]

-- | <i>O(n)</i>. Add a delta to each interval in the map
offset :: (Ord v, Monoid v) => v -> IntervalMap v a -> IntervalMap v a
data IntInterval v
NoInterval :: IntInterval v
IntInterval :: (Interval v) -> v -> IntInterval v
fromList :: Ord v => [(v, v, a)] -> IntervalMap v a
instance GHC.Show.Show v => GHC.Show.Show (Text.Trifecta.Util.IntervalMap.Interval v)
instance GHC.Classes.Ord v => Data.Semigroup.Semigroup (Text.Trifecta.Util.IntervalMap.Interval v)
instance (GHC.Classes.Ord v, GHC.Base.Monoid v) => Data.Semigroup.Reducer.Reducer v (Text.Trifecta.Util.IntervalMap.Interval v)
instance GHC.Classes.Eq v => GHC.Classes.Eq (Text.Trifecta.Util.IntervalMap.Interval v)
instance GHC.Classes.Ord v => GHC.Classes.Ord (Text.Trifecta.Util.IntervalMap.Interval v)
instance GHC.Base.Functor Text.Trifecta.Util.IntervalMap.Interval
instance Data.Foldable.Foldable Text.Trifecta.Util.IntervalMap.Interval
instance Data.Traversable.Traversable Text.Trifecta.Util.IntervalMap.Interval
instance GHC.Base.Functor (Text.Trifecta.Util.IntervalMap.Node v)
instance Control.Lens.Indexed.FunctorWithIndex (Text.Trifecta.Util.IntervalMap.Interval v) (Text.Trifecta.Util.IntervalMap.Node v)
instance Data.Foldable.Foldable (Text.Trifecta.Util.IntervalMap.Node v)
instance Control.Lens.Indexed.FoldableWithIndex (Text.Trifecta.Util.IntervalMap.Interval v) (Text.Trifecta.Util.IntervalMap.Node v)
instance Data.Traversable.Traversable (Text.Trifecta.Util.IntervalMap.Node v)
instance Control.Lens.Indexed.TraversableWithIndex (Text.Trifecta.Util.IntervalMap.Interval v) (Text.Trifecta.Util.IntervalMap.Node v)
instance GHC.Classes.Ord v => GHC.Base.Monoid (Text.Trifecta.Util.IntervalMap.IntInterval v)
instance GHC.Classes.Ord v => Data.FingerTree.Measured (Text.Trifecta.Util.IntervalMap.IntInterval v) (Text.Trifecta.Util.IntervalMap.Node v a)
instance GHC.Base.Functor (Text.Trifecta.Util.IntervalMap.IntervalMap v)
instance Control.Lens.Indexed.FunctorWithIndex (Text.Trifecta.Util.IntervalMap.Interval v) (Text.Trifecta.Util.IntervalMap.IntervalMap v)
instance Data.Foldable.Foldable (Text.Trifecta.Util.IntervalMap.IntervalMap v)
instance Control.Lens.Indexed.FoldableWithIndex (Text.Trifecta.Util.IntervalMap.Interval v) (Text.Trifecta.Util.IntervalMap.IntervalMap v)
instance Data.Traversable.Traversable (Text.Trifecta.Util.IntervalMap.IntervalMap v)
instance Control.Lens.Indexed.TraversableWithIndex (Text.Trifecta.Util.IntervalMap.Interval v) (Text.Trifecta.Util.IntervalMap.IntervalMap v)
instance GHC.Classes.Ord v => Data.FingerTree.Measured (Text.Trifecta.Util.IntervalMap.IntInterval v) (Text.Trifecta.Util.IntervalMap.IntervalMap v a)
instance GHC.Classes.Ord v => Data.Semigroup.Union.HasUnion (Text.Trifecta.Util.IntervalMap.IntervalMap v a)
instance GHC.Classes.Ord v => Data.Semigroup.Union.HasUnion0 (Text.Trifecta.Util.IntervalMap.IntervalMap v a)
instance GHC.Classes.Ord v => GHC.Base.Monoid (Text.Trifecta.Util.IntervalMap.IntervalMap v a)


module Text.Trifecta.Delta
data Delta
Columns :: {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Int64 -> Delta
Tab :: {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Int64 -> Delta
Lines :: {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Int64 -> Delta
Directed :: !ByteString -> {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Int64 -> Delta
class HasDelta t
delta :: HasDelta t => t -> Delta
class HasBytes t
bytes :: HasBytes t => t -> Int64

-- | Increment a column number to the next tabstop.
nextTab :: Int64 -> Int64

-- | Rewind a <a>Delta</a> to the beginning of the line.
rewind :: Delta -> Delta

-- | Should we show two things with a <a>Delta</a> on the same line?
near :: (HasDelta s, HasDelta t) => s -> t -> Bool

-- | Retrieve the character offset within the current line from this
--   <a>Delta</a>.
column :: HasDelta t => t -> Int64

-- | Retrieve the byte offset within the current line from this
--   <a>Delta</a>.
columnByte :: Delta -> Int64
instance GHC.Generics.Generic Text.Trifecta.Delta.Delta
instance Data.Data.Data Text.Trifecta.Delta.Delta
instance GHC.Show.Show Text.Trifecta.Delta.Delta
instance Text.Trifecta.Delta.HasBytes Data.ByteString.Internal.ByteString
instance (Data.FingerTree.Measured v a, Text.Trifecta.Delta.HasBytes v) => Text.Trifecta.Delta.HasBytes (Data.FingerTree.FingerTree v a)
instance GHC.Classes.Eq Text.Trifecta.Delta.Delta
instance GHC.Classes.Ord Text.Trifecta.Delta.Delta
instance (Text.Trifecta.Delta.HasDelta l, Text.Trifecta.Delta.HasDelta r) => Text.Trifecta.Delta.HasDelta (Data.Either.Either l r)
instance Text.PrettyPrint.ANSI.Leijen.Pretty Text.Trifecta.Delta.Delta
instance Text.Trifecta.Delta.HasBytes Text.Trifecta.Delta.Delta
instance Data.Hashable.Class.Hashable Text.Trifecta.Delta.Delta
instance GHC.Base.Monoid Text.Trifecta.Delta.Delta
instance Data.Semigroup.Semigroup Text.Trifecta.Delta.Delta
instance Text.Trifecta.Delta.HasDelta Text.Trifecta.Delta.Delta
instance Text.Trifecta.Delta.HasDelta GHC.Types.Char
instance Text.Trifecta.Delta.HasDelta GHC.Word.Word8
instance Text.Trifecta.Delta.HasDelta Data.ByteString.Internal.ByteString
instance (Data.FingerTree.Measured v a, Text.Trifecta.Delta.HasDelta v) => Text.Trifecta.Delta.HasDelta (Data.FingerTree.FingerTree v a)


module Text.Trifecta.Rope
data Rope
Rope :: !Delta -> !(FingerTree Delta Strand) -> Rope
rope :: FingerTree Delta Strand -> Rope
data Strand
Strand :: {-# UNPACK #-} !ByteString -> !Delta -> Strand
Skipping :: !Delta -> Strand
strand :: ByteString -> Strand
strands :: Rope -> FingerTree Delta Strand

-- | grab a the contents of a rope from a given location up to a newline
grabRest :: Delta -> Rope -> r -> (Delta -> ByteString -> r) -> r

-- | grab a the contents of a rope from a given location up to a newline
grabLine :: Delta -> Rope -> r -> (Delta -> ByteString -> r) -> r
instance GHC.Show.Show Text.Trifecta.Rope.Rope
instance GHC.Generics.Generic Text.Trifecta.Rope.Strand
instance Data.Data.Data Text.Trifecta.Rope.Strand
instance GHC.Show.Show Text.Trifecta.Rope.Strand
instance Data.FingerTree.Measured Text.Trifecta.Delta.Delta Text.Trifecta.Rope.Strand
instance Data.Hashable.Class.Hashable Text.Trifecta.Rope.Strand
instance Text.Trifecta.Delta.HasDelta Text.Trifecta.Rope.Strand
instance Text.Trifecta.Delta.HasBytes Text.Trifecta.Rope.Strand
instance Text.Trifecta.Delta.HasBytes Text.Trifecta.Rope.Rope
instance Text.Trifecta.Delta.HasDelta Text.Trifecta.Rope.Rope
instance Data.FingerTree.Measured Text.Trifecta.Delta.Delta Text.Trifecta.Rope.Rope
instance GHC.Base.Monoid Text.Trifecta.Rope.Rope
instance Data.Semigroup.Semigroup Text.Trifecta.Rope.Rope
instance Data.Semigroup.Reducer.Reducer Text.Trifecta.Rope.Rope Text.Trifecta.Rope.Rope
instance Data.Semigroup.Reducer.Reducer Text.Trifecta.Rope.Strand Text.Trifecta.Rope.Rope
instance Data.Semigroup.Reducer.Reducer Data.ByteString.Internal.ByteString Text.Trifecta.Rope.Rope
instance Data.Semigroup.Reducer.Reducer [GHC.Types.Char] Text.Trifecta.Rope.Rope


-- | harder, better, faster, stronger...
module Text.Trifecta.Util.It
data It r a
Pure :: a -> It r a
It :: a -> (r -> It r a) -> It r a
needIt :: a -> (r -> Maybe a) -> It r a
wantIt :: a -> (r -> (# Bool, a #)) -> It r a
simplifyIt :: It r a -> r -> It r a
runIt :: (a -> o) -> (a -> (r -> It r a) -> o) -> It r a -> o

-- | Given a position, go there, and grab the text forward from that point
fillIt :: r -> (Delta -> ByteString -> r) -> Delta -> It Rope r

-- | Return the text of the line that contains a given position
rewindIt :: Delta -> It Rope (Maybe ByteString)
sliceIt :: Delta -> Delta -> It Rope ByteString
instance GHC.Show.Show a => GHC.Show.Show (Text.Trifecta.Util.It.It r a)
instance GHC.Base.Functor (Text.Trifecta.Util.It.It r)
instance Data.Profunctor.Unsafe.Profunctor Text.Trifecta.Util.It.It
instance GHC.Base.Applicative (Text.Trifecta.Util.It.It r)
instance GHC.Base.Monad (Text.Trifecta.Util.It.It r)
instance Control.Comonad.ComonadApply (Text.Trifecta.Util.It.It r)
instance Control.Comonad.Comonad (Text.Trifecta.Util.It.It r)


module Text.Trifecta.Highlight

-- | Tags used by the <a>TokenParsing</a> <a>highlight</a> combinator.
data Highlight :: *

-- | A <a>HighlightedRope</a> is a <a>Rope</a> with an associated
--   <a>IntervalMap</a> full of highlighted regions.
data HighlightedRope
HighlightedRope :: !(IntervalMap Delta Highlight) -> {-# UNPACK #-} !Rope -> HighlightedRope
class HasHighlightedRope c_a13ko where ropeContent = (.) highlightedRope ropeContent ropeHighlights = (.) highlightedRope ropeHighlights
highlightedRope :: HasHighlightedRope c_a13ko => Lens' c_a13ko HighlightedRope
ropeContent :: HasHighlightedRope c_a13ko => Lens' c_a13ko Rope
ropeHighlights :: HasHighlightedRope c_a13ko => Lens' c_a13ko (IntervalMap Delta Highlight)

-- | Convert a <a>Highlight</a> into a coloration on a <a>Doc</a>.
withHighlight :: Highlight -> Doc -> Doc

-- | Represents a source file like an HsColour rendered document
data HighlightDoc
HighlightDoc :: String -> String -> HighlightedRope -> HighlightDoc
class HasHighlightDoc c_a144H where docContent = (.) highlightDoc docContent docCss = (.) highlightDoc docCss docTitle = (.) highlightDoc docTitle
highlightDoc :: HasHighlightDoc c_a144H => Lens' c_a144H HighlightDoc
docContent :: HasHighlightDoc c_a144H => Lens' c_a144H HighlightedRope
docCss :: HasHighlightDoc c_a144H => Lens' c_a144H String
docTitle :: HasHighlightDoc c_a144H => Lens' c_a144H String

-- | Generate an HTML document from a title and a <a>HighlightedRope</a>.
doc :: String -> HighlightedRope -> HighlightDoc
instance Text.Trifecta.Highlight.HasHighlightDoc Text.Trifecta.Highlight.HighlightDoc
instance Text.Blaze.ToMarkup Text.Trifecta.Highlight.HighlightDoc
instance Text.Trifecta.Highlight.HasHighlightedRope Text.Trifecta.Highlight.HighlightedRope
instance Text.Trifecta.Delta.HasDelta Text.Trifecta.Highlight.HighlightedRope
instance Text.Trifecta.Delta.HasBytes Text.Trifecta.Highlight.HighlightedRope
instance Data.Semigroup.Semigroup Text.Trifecta.Highlight.HighlightedRope
instance GHC.Base.Monoid Text.Trifecta.Highlight.HighlightedRope
instance GHC.Classes.Eq (Text.Trifecta.Highlight.Located a)
instance GHC.Classes.Ord (Text.Trifecta.Highlight.Located a)
instance Text.Blaze.ToMarkup Text.Trifecta.Highlight.HighlightedRope
instance Text.PrettyPrint.ANSI.Leijen.Pretty Text.Trifecta.Highlight.HighlightedRope


-- | The type for Lines will very likely change over time, to enable
--   drawing lit up multi-character versions of control characters for
--   <tt>^Z</tt>, <tt>^[</tt>, <tt><a>0xff</a></tt>, etc. This will make
--   for much nicer diagnostics when working with protocols.
module Text.Trifecta.Rendering
data Rendering
Rendering :: !Delta -> {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Int64 -> (Lines -> Lines) -> (Delta -> Lines -> Lines) -> Rendering
class HasRendering c_a1c2U where renderingDelta = (.) rendering renderingDelta renderingLine = (.) rendering renderingLine renderingLineBytes = (.) rendering renderingLineBytes renderingLineLen = (.) rendering renderingLineLen renderingOverlays = (.) rendering renderingOverlays
rendering :: HasRendering c_a1c2U => Lens' c_a1c2U Rendering
renderingDelta :: HasRendering c_a1c2U => Lens' c_a1c2U Delta
renderingLine :: HasRendering c_a1c2U => Lens' c_a1c2U (Lines -> Lines)
renderingLineBytes :: HasRendering c_a1c2U => Lens' c_a1c2U Int64
renderingLineLen :: HasRendering c_a1c2U => Lens' c_a1c2U Int64
renderingOverlays :: HasRendering c_a1c2U => Lens' c_a1c2U (Delta -> Lines -> Lines)
nullRendering :: Rendering -> Bool
emptyRendering :: Rendering
class Source t
source :: Source t => t -> (Int64, Int64, Lines -> Lines)

-- | create a drawing surface
rendered :: Source s => Delta -> s -> Rendering
class Renderable t
render :: Renderable t => t -> Rendering
data Rendered a
(:@) :: a -> Rendering -> Rendered a

-- | <pre>
--   In file included from baz.c:9
--   In file included from bar.c:4
--   foo.c:8:36: note
--   int main(int argc, char ** argv) { int; }
--                                      ^
--   </pre>
data Caret
Caret :: !Delta -> {-# UNPACK #-} !ByteString -> Caret
class HasCaret t
caret :: HasCaret t => Lens' t Caret
data Careted a
(:^) :: a -> Caret -> Careted a
drawCaret :: Delta -> Delta -> Lines -> Lines
addCaret :: Delta -> Rendering -> Rendering
caretEffects :: [SGR]
renderingCaret :: Delta -> ByteString -> Rendering
data Span
Span :: !Delta -> !Delta -> {-# UNPACK #-} !ByteString -> Span
class HasSpan t
span :: HasSpan t => Lens' t Span
data Spanned a
(:~) :: a -> Span -> Spanned a
spanEffects :: [SGR]
drawSpan :: Delta -> Delta -> Delta -> Lines -> Lines

-- | <pre>
--   int main(int argc, char ** argv) { int; }
--                                      ^~~
--   </pre>
addSpan :: Delta -> Delta -> Rendering -> Rendering
data Fixit
Fixit :: {-# UNPACK #-} !Span -> !ByteString -> Fixit
[_fixitSpan] :: Fixit -> {-# UNPACK #-} !Span
[_fixitReplacement] :: Fixit -> !ByteString
class HasFixit c_a1dl5 where fixitReplacement = (.) fixit fixitReplacement fixitSpan = (.) fixit fixitSpan
fixit :: HasFixit c_a1dl5 => Lens' c_a1dl5 Fixit
fixitReplacement :: HasFixit c_a1dl5 => Lens' c_a1dl5 ByteString
fixitSpan :: HasFixit c_a1dl5 => Lens' c_a1dl5 Span
drawFixit :: Delta -> Delta -> String -> Delta -> Lines -> Lines
addFixit :: Delta -> Delta -> String -> Rendering -> Rendering
type Lines = Array (Int, Int64) ([SGR], Char)
draw :: [SGR] -> Int -> Int64 -> String -> Lines -> Lines
ifNear :: Delta -> (Lines -> Lines) -> Delta -> Lines -> Lines
(.#) :: (Delta -> Lines -> Lines) -> Rendering -> Rendering
instance Text.Trifecta.Rendering.HasFixit Text.Trifecta.Rendering.Fixit
instance Text.Trifecta.Rendering.HasSpan Text.Trifecta.Rendering.Fixit
instance Data.Hashable.Class.Hashable Text.Trifecta.Rendering.Fixit
instance Data.Semigroup.Reducer.Reducer Text.Trifecta.Rendering.Fixit Text.Trifecta.Rendering.Rendering
instance Text.Trifecta.Rendering.Renderable Text.Trifecta.Rendering.Fixit
instance GHC.Generics.Generic Text.Trifecta.Rendering.Fixit
instance Data.Data.Data Text.Trifecta.Rendering.Fixit
instance GHC.Show.Show Text.Trifecta.Rendering.Fixit
instance GHC.Classes.Ord Text.Trifecta.Rendering.Fixit
instance GHC.Classes.Eq Text.Trifecta.Rendering.Fixit
instance GHC.Generics.Generic (Text.Trifecta.Rendering.Spanned a)
instance Data.Data.Data a => Data.Data.Data (Text.Trifecta.Rendering.Spanned a)
instance GHC.Show.Show a => GHC.Show.Show (Text.Trifecta.Rendering.Spanned a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Text.Trifecta.Rendering.Spanned a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Text.Trifecta.Rendering.Spanned a)
instance GHC.Generics.Generic Text.Trifecta.Rendering.Span
instance Data.Data.Data Text.Trifecta.Rendering.Span
instance GHC.Show.Show Text.Trifecta.Rendering.Span
instance GHC.Classes.Ord Text.Trifecta.Rendering.Span
instance GHC.Classes.Eq Text.Trifecta.Rendering.Span
instance GHC.Generics.Generic (Text.Trifecta.Rendering.Careted a)
instance Data.Data.Data a => Data.Data.Data (Text.Trifecta.Rendering.Careted a)
instance GHC.Show.Show a => GHC.Show.Show (Text.Trifecta.Rendering.Careted a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Text.Trifecta.Rendering.Careted a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Text.Trifecta.Rendering.Careted a)
instance GHC.Generics.Generic Text.Trifecta.Rendering.Caret
instance Data.Data.Data Text.Trifecta.Rendering.Caret
instance GHC.Show.Show Text.Trifecta.Rendering.Caret
instance GHC.Classes.Ord Text.Trifecta.Rendering.Caret
instance GHC.Classes.Eq Text.Trifecta.Rendering.Caret
instance GHC.Show.Show a => GHC.Show.Show (Text.Trifecta.Rendering.Rendered a)
instance Text.Trifecta.Rendering.HasRendering Text.Trifecta.Rendering.Rendering
instance GHC.Show.Show Text.Trifecta.Rendering.Rendering
instance Data.Semigroup.Semigroup Text.Trifecta.Rendering.Rendering
instance GHC.Base.Monoid Text.Trifecta.Rendering.Rendering
instance Text.Trifecta.Delta.HasDelta Text.Trifecta.Rendering.Rendering
instance Text.Trifecta.Rendering.Renderable Text.Trifecta.Rendering.Rendering
instance Text.Trifecta.Rendering.Source GHC.Base.String
instance Text.Trifecta.Rendering.Source Data.ByteString.Internal.ByteString
instance Text.PrettyPrint.ANSI.Leijen.Pretty Text.Trifecta.Rendering.Rendering
instance GHC.Base.Functor Text.Trifecta.Rendering.Rendered
instance Text.Trifecta.Delta.HasDelta (Text.Trifecta.Rendering.Rendered a)
instance Text.Trifecta.Delta.HasBytes (Text.Trifecta.Rendering.Rendered a)
instance Control.Comonad.Comonad Text.Trifecta.Rendering.Rendered
instance Control.Comonad.ComonadApply Text.Trifecta.Rendering.Rendered
instance Data.Foldable.Foldable Text.Trifecta.Rendering.Rendered
instance Data.Traversable.Traversable Text.Trifecta.Rendering.Rendered
instance Text.Trifecta.Rendering.Renderable (Text.Trifecta.Rendering.Rendered a)
instance Text.Trifecta.Rendering.HasCaret Text.Trifecta.Rendering.Caret
instance Data.Hashable.Class.Hashable Text.Trifecta.Rendering.Caret
instance Text.Trifecta.Delta.HasBytes Text.Trifecta.Rendering.Caret
instance Text.Trifecta.Delta.HasDelta Text.Trifecta.Rendering.Caret
instance Text.Trifecta.Rendering.Renderable Text.Trifecta.Rendering.Caret
instance Data.Semigroup.Reducer.Reducer Text.Trifecta.Rendering.Caret Text.Trifecta.Rendering.Rendering
instance Data.Semigroup.Semigroup Text.Trifecta.Rendering.Caret
instance Text.Trifecta.Rendering.HasCaret (Text.Trifecta.Rendering.Careted a)
instance GHC.Base.Functor Text.Trifecta.Rendering.Careted
instance Text.Trifecta.Delta.HasDelta (Text.Trifecta.Rendering.Careted a)
instance Text.Trifecta.Delta.HasBytes (Text.Trifecta.Rendering.Careted a)
instance Control.Comonad.Comonad Text.Trifecta.Rendering.Careted
instance Control.Comonad.ComonadApply Text.Trifecta.Rendering.Careted
instance Data.Foldable.Foldable Text.Trifecta.Rendering.Careted
instance Data.Traversable.Traversable Text.Trifecta.Rendering.Careted
instance Text.Trifecta.Rendering.Renderable (Text.Trifecta.Rendering.Careted a)
instance Data.Semigroup.Reducer.Reducer (Text.Trifecta.Rendering.Careted a) Text.Trifecta.Rendering.Rendering
instance Data.Hashable.Class.Hashable a => Data.Hashable.Class.Hashable (Text.Trifecta.Rendering.Careted a)
instance Text.Trifecta.Rendering.HasSpan Text.Trifecta.Rendering.Span
instance Text.Trifecta.Rendering.Renderable Text.Trifecta.Rendering.Span
instance Data.Semigroup.Semigroup Text.Trifecta.Rendering.Span
instance Data.Semigroup.Reducer.Reducer Text.Trifecta.Rendering.Span Text.Trifecta.Rendering.Rendering
instance Data.Hashable.Class.Hashable Text.Trifecta.Rendering.Span
instance Text.Trifecta.Rendering.HasSpan (Text.Trifecta.Rendering.Spanned a)
instance GHC.Base.Functor Text.Trifecta.Rendering.Spanned
instance Control.Comonad.Comonad Text.Trifecta.Rendering.Spanned
instance Control.Comonad.ComonadApply Text.Trifecta.Rendering.Spanned
instance Data.Foldable.Foldable Text.Trifecta.Rendering.Spanned
instance Data.Traversable.Traversable Text.Trifecta.Rendering.Spanned
instance Data.Semigroup.Reducer.Reducer (Text.Trifecta.Rendering.Spanned a) Text.Trifecta.Rendering.Rendering
instance Text.Trifecta.Rendering.Renderable (Text.Trifecta.Rendering.Spanned a)
instance Data.Hashable.Class.Hashable a => Data.Hashable.Class.Hashable (Text.Trifecta.Rendering.Spanned a)


module Text.Trifecta.Combinators

-- | This class provides parsers with easy access to:
--   
--   1) the current line contents. 2) the current position as a
--   <a>Delta</a>. 3) the ability to use <a>sliced</a> on any parser.
class (MonadPlus m, TokenParsing m) => DeltaParsing m where rend = rendered <$> position <*> line restOfLine = drop . fromIntegral . columnByte <$> position <*> line

-- | Retrieve the contents of the current line (from the beginning of the
--   line)
line :: DeltaParsing m => m ByteString

-- | Retrieve the current position as a <a>Delta</a>.
position :: DeltaParsing m => m Delta

-- | Run a parser, grabbing all of the text between its start and end
--   points
slicedWith :: DeltaParsing m => (a -> ByteString -> r) -> m a -> m r

-- | Retrieve a <a>Rendering</a> of the current line noting this position,
--   but not placing a <a>Caret</a> there.
rend :: DeltaParsing m => m Rendering

-- | Grab the remainder of the current line
restOfLine :: DeltaParsing m => m ByteString

-- | Run a parser, grabbing all of the text between its start and end
--   points and discarding the original result
sliced :: DeltaParsing m => m a -> m ByteString

-- | Grab a <a>Caret</a> pointing to the current location.
careting :: DeltaParsing m => m Caret

-- | Parse a <a>Careted</a> result. Pointing the <a>Caret</a> to where you
--   start.
careted :: DeltaParsing m => m a -> m (Careted a)

-- | Discard the result of a parse, returning a <a>Span</a> from where we
--   start to where it ended parsing.
spanning :: DeltaParsing m => m a -> m Span

-- | Parse a <a>Spanned</a> result. The <a>Span</a> starts here and runs to
--   the last position parsed.
spanned :: DeltaParsing m => m a -> m (Spanned a)

-- | Grab a fixit.
fixiting :: DeltaParsing m => m ByteString -> m Fixit

-- | This class is a refinement of <a>DeltaParsing</a> that adds the
--   ability to mark your position in the input and return there for
--   further parsing later.
class (DeltaParsing m, HasDelta d) => MarkParsing d m | m -> d

-- | mark the current location so it can be used in constructing a span, or
--   for later seeking
mark :: MarkParsing d m => m d

-- | Seek a previously marked location
release :: MarkParsing d m => d -> m ()
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.DeltaParsing m) => Text.Trifecta.Combinators.DeltaParsing (Control.Monad.Trans.State.Lazy.StateT s m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.DeltaParsing m) => Text.Trifecta.Combinators.DeltaParsing (Control.Monad.Trans.State.Strict.StateT s m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.DeltaParsing m) => Text.Trifecta.Combinators.DeltaParsing (Control.Monad.Trans.Reader.ReaderT e m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.DeltaParsing m, GHC.Base.Monoid w) => Text.Trifecta.Combinators.DeltaParsing (Control.Monad.Trans.Writer.Strict.WriterT w m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.DeltaParsing m, GHC.Base.Monoid w) => Text.Trifecta.Combinators.DeltaParsing (Control.Monad.Trans.Writer.Lazy.WriterT w m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.DeltaParsing m, GHC.Base.Monoid w) => Text.Trifecta.Combinators.DeltaParsing (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.DeltaParsing m, GHC.Base.Monoid w) => Text.Trifecta.Combinators.DeltaParsing (Control.Monad.Trans.RWS.Strict.RWST r w s m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.DeltaParsing m) => Text.Trifecta.Combinators.DeltaParsing (Control.Monad.Trans.Identity.IdentityT m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.MarkParsing d m) => Text.Trifecta.Combinators.MarkParsing d (Control.Monad.Trans.State.Lazy.StateT s m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.MarkParsing d m) => Text.Trifecta.Combinators.MarkParsing d (Control.Monad.Trans.State.Strict.StateT s m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.MarkParsing d m) => Text.Trifecta.Combinators.MarkParsing d (Control.Monad.Trans.Reader.ReaderT e m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.MarkParsing d m, GHC.Base.Monoid w) => Text.Trifecta.Combinators.MarkParsing d (Control.Monad.Trans.Writer.Strict.WriterT w m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.MarkParsing d m, GHC.Base.Monoid w) => Text.Trifecta.Combinators.MarkParsing d (Control.Monad.Trans.Writer.Lazy.WriterT w m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.MarkParsing d m, GHC.Base.Monoid w) => Text.Trifecta.Combinators.MarkParsing d (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.MarkParsing d m, GHC.Base.Monoid w) => Text.Trifecta.Combinators.MarkParsing d (Control.Monad.Trans.RWS.Strict.RWST r w s m)
instance (GHC.Base.MonadPlus m, Text.Trifecta.Combinators.MarkParsing d m) => Text.Trifecta.Combinators.MarkParsing d (Control.Monad.Trans.Identity.IdentityT m)


-- | Results and Parse Errors
module Text.Trifecta.Result

-- | The result of parsing. Either we succeeded or something went wrong.
data Result a
Success :: a -> Result a
Failure :: ErrInfo -> Result a

-- | A <a>Prism</a> that lets you embed or retrieve a <a>Result</a> in a
--   potentially larger type.
class AsResult s t a b | s -> a, t -> b, s b -> t, t a -> s
_Result :: AsResult s t a b => Prism s t (Result a) (Result b)

-- | The <a>Prism</a> for the <a>Success</a> constructor of <a>Result</a>
_Success :: AsResult s t a b => Prism s t a b

-- | The <a>Prism</a> for the <a>Failure</a> constructor of <a>Result</a>
_Failure :: AsResult s s a a => Prism' s ErrInfo

-- | This is used to report an error. What went wrong, some supplemental
--   docs and a set of things expected at the current location. This does
--   not, however, include the actual location.
data Err
Err :: Maybe Doc -> [Doc] -> Set String -> [Delta] -> Err
[_reason] :: Err -> Maybe Doc
[_footnotes] :: Err -> [Doc]
[_expected] :: Err -> Set String
[_finalDeltas] :: Err -> [Delta]
class HasErr c_a2erE where expected = (.) err expected finalDeltas = (.) err finalDeltas footnotes = (.) err footnotes reason = (.) err reason
err :: HasErr c_a2erE => Lens' c_a2erE Err
expected :: HasErr c_a2erE => Lens' c_a2erE (Set String)
finalDeltas :: HasErr c_a2erE => Lens' c_a2erE [Delta]
footnotes :: HasErr c_a2erE => Lens' c_a2erE [Doc]
reason :: HasErr c_a2erE => Lens' c_a2erE (Maybe Doc)
class Errable m
raiseErr :: Errable m => Err -> m a
data ErrInfo
ErrInfo :: Doc -> [Delta] -> ErrInfo
[_errDoc] :: ErrInfo -> Doc
[_errDeltas] :: ErrInfo -> [Delta]

-- | Convert a location and an <a>Err</a> into a <a>Doc</a>
explain :: Rendering -> Err -> Doc

-- | Generate a simple <a>Err</a> word-wrapping the supplied message.
failed :: String -> Err
instance Data.Traversable.Traversable Text.Trifecta.Result.Result
instance Data.Foldable.Foldable Text.Trifecta.Result.Result
instance GHC.Base.Functor Text.Trifecta.Result.Result
instance GHC.Show.Show a => GHC.Show.Show (Text.Trifecta.Result.Result a)
instance Text.Trifecta.Result.HasErr Text.Trifecta.Result.Err
instance Data.Semigroup.Semigroup Text.Trifecta.Result.Err
instance GHC.Base.Monoid Text.Trifecta.Result.Err
instance GHC.Base.Monoid Text.Trifecta.Result.ErrInfo
instance Text.Trifecta.Result.AsResult (Text.Trifecta.Result.Result a) (Text.Trifecta.Result.Result b) a b
instance GHC.Show.Show a => Text.PrettyPrint.ANSI.Leijen.Pretty (Text.Trifecta.Result.Result a)
instance GHC.Base.Applicative Text.Trifecta.Result.Result
instance GHC.Base.Alternative Text.Trifecta.Result.Result
instance GHC.Show.Show Text.Trifecta.Result.ErrInfo


module Text.Trifecta.Parser

-- | The type of a trifecta parser
--   
--   The first four arguments are behavior continuations:
--   
--   <ul>
--   <li>epsilon success: the parser has consumed no input and has a result
--   as well as a possible Err; the position and chunk are unchanged (see
--   <a>pure</a>)</li>
--   <li>epsilon failure: the parser has consumed no input and is failing
--   with the given Err; the position and chunk are unchanged (see
--   <a>empty</a>)</li>
--   <li>committed success: the parser has consumed input and is yielding
--   the result, set of expected strings that would have permitted this
--   parse to continue, new position, and residual chunk to the
--   continuation.</li>
--   <li>committed failure: the parser has consumed input and is failing
--   with a given ErrInfo (user-facing error message)</li>
--   </ul>
--   
--   The remaining two arguments are
--   
--   <ul>
--   <li>the current position</li>
--   <li>the chunk of input currently under analysis</li>
--   </ul>
--   
--   <a>Parser</a> is an <a>Alternative</a>; trifecta's backtracking
--   behavior encoded as <a>&lt;|&gt;</a> is to behave as the leftmost
--   parser which yields a value (regardless of any input being consumed)
--   or which consumes input and fails. That is, a choice of parsers will
--   only yield an epsilon failure if *all* parsers in the choice do. If
--   that is not the desired behavior, see <a>try</a>, which turns a
--   committed parser failure into an epsilon failure (at the cost of error
--   information).
newtype Parser a
Parser :: (forall r. (a -> Err -> It Rope r) -> (Err -> It Rope r) -> (a -> Set String -> Delta -> ByteString -> It Rope r) -> (ErrInfo -> It Rope r) -> Delta -> ByteString -> It Rope r) -> Parser a
[unparser] :: Parser a -> forall r. (a -> Err -> It Rope r) -> (Err -> It Rope r) -> (a -> Set String -> Delta -> ByteString -> It Rope r) -> (ErrInfo -> It Rope r) -> Delta -> ByteString -> It Rope r
manyAccum :: (a -> [a] -> [a]) -> Parser a -> Parser [a]
data Step a
StepDone :: !Rope -> a -> Step a
StepFail :: !Rope -> ErrInfo -> Step a
StepCont :: !Rope -> (Result a) -> (Rope -> Step a) -> Step a
feed :: Reducer t Rope => t -> Step r -> Step r
starve :: Step a -> Result a
stepParser :: Parser a -> Delta -> ByteString -> Step a
stepResult :: Rope -> Result a -> Step a
stepIt :: It Rope a -> Step a

-- | <tt>parseFromFile p filePath</tt> runs a parser <tt>p</tt> on the
--   input read from <tt>filePath</tt> using <a>readFile</a>. All
--   diagnostic messages emitted over the course of the parse attempt are
--   shown to the user on the console.
--   
--   <pre>
--   main = do
--     result &lt;- parseFromFile numbers "digits.txt"
--     case result of
--       Nothing -&gt; return ()
--       Just a  -&gt; print $ sum a
--   </pre>
parseFromFile :: MonadIO m => Parser a -> String -> m (Maybe a)

-- | <tt>parseFromFileEx p filePath</tt> runs a parser <tt>p</tt> on the
--   input read from <tt>filePath</tt> using <a>readFile</a>. Returns all
--   diagnostic messages emitted over the course of the parse and the
--   answer if the parse was successful.
--   
--   <pre>
--   main = do
--     result &lt;- parseFromFileEx (many number) "digits.txt"
--     case result of
--       Failure xs -&gt; displayLn xs
--       Success a  -&gt; print (sum a)
--   </pre>
parseFromFileEx :: MonadIO m => Parser a -> String -> m (Result a)
parseString :: Parser a -> Delta -> String -> Result a

-- | <tt>parseByteString p delta i</tt> runs a parser <tt>p</tt> on
--   <tt>i</tt>.
parseByteString :: Parser a -> Delta -> ByteString -> Result a
parseTest :: (MonadIO m, Show a) => Parser a -> String -> m ()
instance GHC.Base.Functor Text.Trifecta.Parser.Parser
instance GHC.Base.Applicative Text.Trifecta.Parser.Parser
instance GHC.Base.Alternative Text.Trifecta.Parser.Parser
instance Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (Text.Trifecta.Parser.Parser a)
instance GHC.Base.Monoid a => GHC.Base.Monoid (Text.Trifecta.Parser.Parser a)
instance GHC.Base.Monad Text.Trifecta.Parser.Parser
instance GHC.Base.MonadPlus Text.Trifecta.Parser.Parser
instance Text.Parser.Combinators.Parsing Text.Trifecta.Parser.Parser
instance Text.Trifecta.Result.Errable Text.Trifecta.Parser.Parser
instance Text.Parser.LookAhead.LookAheadParsing Text.Trifecta.Parser.Parser
instance Text.Parser.Char.CharParsing Text.Trifecta.Parser.Parser
instance Text.Parser.Token.TokenParsing Text.Trifecta.Parser.Parser
instance Text.Trifecta.Combinators.DeltaParsing Text.Trifecta.Parser.Parser
instance Text.Trifecta.Combinators.MarkParsing Text.Trifecta.Delta.Delta Text.Trifecta.Parser.Parser
instance GHC.Show.Show a => GHC.Show.Show (Text.Trifecta.Parser.Step a)
instance GHC.Base.Functor Text.Trifecta.Parser.Step


module Text.Trifecta
