-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A modern parser combinator library with convenient diagnostics -- -- A modern unicode-aware parser combinator library with slicing and -- Clang-style colored diagnostics @package trifecta @version 0.44 -- | A fairly straightforward set of common error levels. module Text.Trifecta.Diagnostic.Level -- | The severity of an error (or message) data DiagnosticLevel -- | a comment we should only show to the excessively curious Verbose :: !Int -> DiagnosticLevel -- | a comment Note :: DiagnosticLevel -- | a warning, computation continues Warning :: DiagnosticLevel -- | a user specified error Error :: DiagnosticLevel -- | a user specified fatal error Fatal :: DiagnosticLevel -- | a non-maskable death sentence thrown by the parser itself Panic :: DiagnosticLevel instance Eq DiagnosticLevel instance Show DiagnosticLevel instance Read DiagnosticLevel instance PrettyTerm DiagnosticLevel instance Pretty DiagnosticLevel instance Semigroup DiagnosticLevel instance Ord DiagnosticLevel module Text.Trifecta.Rope.Bytes class HasBytes t bytes :: HasBytes t => t -> Int64 instance (Measured v a, HasBytes v) => HasBytes (FingerTree v a) instance HasBytes ByteString module Text.Trifecta.Rope.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 nextTab :: Int64 -> Int64 rewind :: Delta -> Delta near :: (HasDelta s, HasDelta t) => s -> t -> Bool column :: HasDelta t => t -> Int64 columnByte :: Delta -> Int64 instance Show Delta instance (Measured v a, HasDelta v) => HasDelta (FingerTree v a) instance HasDelta ByteString instance HasDelta Word8 instance HasDelta Char instance HasDelta Delta instance Semigroup Delta instance Monoid Delta instance Hashable Delta instance HasBytes Delta instance PrettyTerm Delta instance Pretty Delta instance (HasDelta l, HasDelta r) => HasDelta (Either l r) instance Ord Delta instance Eq Delta module Text.Trifecta.Rope.Prim data Rope Rope :: !Delta -> !FingerTree Delta Strand -> Rope rope :: FingerTree Delta Strand -> Rope data Strand Strand :: {-# UNPACK #-} !ByteString -> !Delta -> Strand LineDirective :: {-# UNPACK #-} !ByteString -> {-# UNPACK #-} !Int64 -> 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 Show Strand instance Show Rope instance Reducer [Char] Rope instance Reducer ByteString Rope instance Reducer Strand Rope instance Reducer Rope Rope instance Semigroup Rope instance Monoid Rope instance Measured Delta Rope instance HasDelta Rope instance HasBytes Rope instance HasBytes Strand instance HasDelta Strand instance Hashable Strand instance Measured Delta Strand -- | Interval maps implemented using the FingerTree type, following -- section 4.8 of -- -- -- -- An amortized running time is given for each operation, with n -- referring to the size of the priority queue. These bounds hold even in -- a persistent (shared) setting. -- -- Note: Many of these operations have the same names as similar -- operations on lists in the Prelude. The ambiguity may be -- resolved using either qualification or the hiding clause. -- -- Unlike Data.IntervalMap.FingerTree, 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.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 Foldable -- and Traversable 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) -- | O(1). Interval map with a single entry. singleton :: Ord v => Interval v -> a -> IntervalMap v a -- | O(log n). 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 -- | O(k log (n/k)). All intervals that contain the given -- point, in lexicographical order. search :: Ord v => v -> IntervalMap v a -> [(Interval v, a)] -- | O(k log (n/k)). All intervals that intersect with the -- given interval, in lexicographical order. intersections :: Ord v => v -> v -> IntervalMap v a -> [(Interval v, a)] -- | O(k log (n/k)). All intervals that contain the given -- interval, in lexicographical order. dominators :: Ord v => v -> v -> IntervalMap v a -> [(Interval v, a)] -- | O(n). 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 Show v => Show (Interval v) instance Ord v => Plus (IntervalMap v) instance Ord v => Alt (IntervalMap v) instance Ord v => Monoid (IntervalMap v a) instance Ord v => HasUnion0 (IntervalMap v a) instance Ord v => HasUnion (IntervalMap v a) instance Ord v => Measured (IntInterval v) (IntervalMap v a) instance TraversableWithKey (IntervalMap v) instance Traversable (IntervalMap v) instance FoldableWithKey (IntervalMap v) instance Foldable (IntervalMap v) instance Keyed (IntervalMap v) instance Functor (IntervalMap v) instance Ord v => Measured (IntInterval v) (Node v a) instance Ord v => Monoid (IntInterval v) instance TraversableWithKey1 (Node v) instance Traversable1 (Node v) instance FoldableWithKey1 (Node v) instance Foldable1 (Node v) instance TraversableWithKey (Node v) instance Traversable (Node v) instance FoldableWithKey (Node v) instance Foldable (Node v) instance Keyed (Node v) instance Bifunctor Node instance Functor (Node v) instance Pointed Interval instance Traversable1 Interval instance Foldable1 Interval instance Traversable Interval instance Foldable Interval instance Functor Interval instance Ord v => Ord (Interval v) instance Eq v => Eq (Interval v) instance (Ord v, Monoid v) => Reducer v (Interval v) instance Ord v => Semigroup (Interval v) module Text.Trifecta.Highlight.Prim data Highlight EscapeCode :: Highlight Number :: Highlight Comment :: Highlight CharLiteral :: Highlight StringLiteral :: Highlight Constant :: Highlight Statement :: Highlight Special :: Highlight Symbol :: Highlight Identifier :: Highlight ReservedIdentifier :: Highlight Operator :: Highlight ReservedOperator :: Highlight Constructor :: Highlight ReservedConstructor :: Highlight ConstructorOperator :: Highlight ReservedConstructorOperator :: Highlight BadInput :: Highlight Unbound :: Highlight Layout :: Highlight MatchedSymbols :: Highlight type Highlights = IntervalMap Delta Highlight instance Eq Highlight instance Ord Highlight instance Show Highlight instance Read Highlight instance Enum Highlight instance Ix Highlight instance Bounded Highlight module Text.Trifecta.Highlight.Class class Highlightable a addHighlights :: Highlightable a => Highlights -> a -> a module Text.Trifecta.Highlight.Effects highlightEffects :: Highlight -> [ScopedEffect] pushToken, popToken :: Highlight -> TermDoc withHighlight :: Highlight -> TermDoc -> TermDoc module Text.Trifecta.Rope.Highlighted data HighlightedRope HighlightedRope :: !Highlights -> {-# UNPACK #-} !Rope -> HighlightedRope ropeHighlights :: HighlightedRope -> !Highlights ropeContent :: HighlightedRope -> {-# UNPACK #-} !Rope instance PrettyTerm HighlightedRope instance Pretty HighlightedRope instance ToHtml HighlightedRope instance Ord (Located a) instance Eq (Located a) instance Highlightable HighlightedRope instance Monoid HighlightedRope instance Semigroup HighlightedRope instance HasBytes HighlightedRope instance HasDelta HighlightedRope module Text.Trifecta.Highlight.Rendering.HTML -- | Represents a source file like an HsColour rendered document data Doc Doc :: String -> String -> HighlightedRope -> Doc docTitle :: Doc -> String docCss :: Doc -> String docContent :: Doc -> HighlightedRope -- |
--   renderHtml $ toHtml $ addHighlights highlightedRope $ doc "Foo.hs"
--   
doc :: String -> Doc instance Highlightable Doc instance ToHtml Doc -- | The type for Lines will very likely change over time, to enable -- drawing lit up multi-character versions of control characters for -- ^Z, ^[, 0xff, etc. This will make -- for much nicer diagnostics when working with protocols. module Text.Trifecta.Diagnostic.Rendering.Prim data Rendering Rendering :: !Delta -> {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Int64 -> (Lines -> Lines) -> (Delta -> Lines -> Lines) -> Rendering renderingDelta :: Rendering -> !Delta renderingLineLen :: Rendering -> {-# UNPACK #-} !Int64 renderingLineBytes :: Rendering -> {-# UNPACK #-} !Int64 renderingLine :: Rendering -> Lines -> Lines renderingOverlays :: Rendering -> Delta -> Lines -> Lines nullRendering :: Rendering -> Bool emptyRendering :: Rendering class Source t source :: Source t => t -> (Int64, Int64, Lines -> Lines) -- | create a drawing surface rendering :: Source s => Delta -> s -> Rendering class Renderable t render :: Renderable t => t -> Rendering data Rendered a (:@) :: a -> Rendering -> Rendered a type Lines = Array (Int, Int64) ([ScopedEffect], Char) draw :: [ScopedEffect] -> Int -> Int64 -> String -> Lines -> Lines ifNear :: Delta -> (Lines -> Lines) -> Delta -> Lines -> Lines (.#) :: (Delta -> Lines -> Lines) -> Rendering -> Rendering instance Show a => Show (Rendered a) instance Renderable (Rendered a) instance Traversable1 Rendered instance Foldable1 Rendered instance Traversable Rendered instance Foldable Rendered instance Bind Rendered instance Apply Rendered instance Comonad Rendered instance Extend Rendered instance HasBytes (Rendered a) instance HasDelta (Rendered a) instance Functor Rendered instance PrettyTerm Rendering instance Pretty Rendering instance Source ByteString instance Source String instance Renderable Rendering instance HasDelta Rendering instance Monoid Rendering instance Semigroup Rendering instance Show Rendering instance Highlightable Rendering -- | Rich diagnostics module Text.Trifecta.Diagnostic.Prim data Diagnostic m Diagnostic :: !Either String Rendering -> !DiagnosticLevel -> m -> [Diagnostic m] -> Diagnostic m tellDiagnostic :: (MonadWriter t m, Reducer (Diagnostic e) t) => Diagnostic e -> m () instance Typeable1 Diagnostic instance Show m => Show (Diagnostic m) instance Traversable1 Diagnostic instance Foldable1 Diagnostic instance Traversable Diagnostic instance Foldable Diagnostic instance Functor Diagnostic instance PrettyTerm m => PrettyTerm (Diagnostic m) instance Pretty m => Pretty (Diagnostic m) instance Comonad Diagnostic instance Extend Diagnostic instance HasBytes (Diagnostic m) instance HasDelta (Diagnostic m) instance Renderable (Diagnostic m) instance (Typeable m, Show m) => Exception (Diagnostic m) instance Highlightable (Diagnostic e) module Text.Trifecta.Diagnostic.Err.Log data ErrLog e ErrLog :: !Seq (Diagnostic e) -> !Highlights -> ErrLog e errLog :: ErrLog e -> !Seq (Diagnostic e) errHighlights :: ErrLog e -> !Highlights instance Monoid (ErrLog e) instance Semigroup (ErrLog e) instance Plus ErrLog instance Alt ErrLog instance Functor ErrLog module Text.Trifecta.Parser.Result data Result e a Success :: !Seq (Diagnostic e) -> a -> Result e a Failure :: !Seq (Diagnostic e) -> Result e a instance (Show e, Show a) => Show (Result e a) instance Alternative (Result e) instance Plus (Result e) instance Alt (Result e) instance Apply (Result e) instance Applicative (Result e) instance Traversable (Result e) instance Foldable (Result e) instance Bifunctor Result instance Functor (Result e) instance (PrettyTerm e, Show a) => PrettyTerm (Result e a) instance (Pretty e, Show a) => Pretty (Result e a) module Text.Trifecta.Parser.Step data Step e a StepDone :: !Rope -> !Seq (Diagnostic e) -> a -> Step e a StepFail :: !Rope -> !Seq (Diagnostic e) -> Step e a StepCont :: !Rope -> (Result e a) -> (Rope -> Step e a) -> Step e a feed :: Reducer t Rope => t -> Step e r -> Step e r starve :: Step e a -> Result e a stepResult :: Rope -> Result e a -> Step e a instance Bifunctor Step instance Functor (Step e) instance (Show e, Show a) => Show (Step e a) -- | harder, better, faster, stronger... module Text.Trifecta.Parser.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 stepIt :: It Rope a -> Step e a instance Comonad (It r) instance Extend (It r) instance Bind (It r) instance Apply (It r) instance Monad (It r) instance Zip (It r) instance Lookup (It r) instance Indexable (It r) instance Applicative (It r) instance Profunctor It instance Functor (It r) instance Show a => Show (It r a) -- | Provides a class for logging and throwing expressive diagnostics. module Text.Trifecta.Diagnostic.Class class Monad m => MonadDiagnostic e m | m -> e fatalWith :: MonadDiagnostic e m => [Diagnostic e] -> [Rendering] -> e -> m a errWith :: MonadDiagnostic e m => [Diagnostic e] -> [Rendering] -> e -> m a logWith :: MonadDiagnostic e m => DiagnosticLevel -> [Diagnostic e] -> [Rendering] -> e -> m () instance MonadDiagnostic e m => MonadDiagnostic e (IdentityT m) instance (MonadDiagnostic e m, Monoid w) => MonadDiagnostic e (RWST r w s m) instance (MonadDiagnostic e m, Monoid w) => MonadDiagnostic e (RWST r w s m) instance (MonadDiagnostic e m, Monoid w) => MonadDiagnostic e (WriterT w m) instance (MonadDiagnostic e m, Monoid w) => MonadDiagnostic e (WriterT w m) instance MonadDiagnostic e m => MonadDiagnostic e (ReaderT r m) instance MonadDiagnostic e m => MonadDiagnostic e (StateT s m) instance MonadDiagnostic e m => MonadDiagnostic e (StateT s m) -- | Combinators for throwing and logging expressive diagnostics module Text.Trifecta.Diagnostic.Combinators fatal :: MonadDiagnostic e m => e -> m a err :: MonadDiagnostic e m => e -> m a warn :: MonadDiagnostic e m => e -> m () note :: MonadDiagnostic e m => e -> m () verbose :: MonadDiagnostic e m => Int -> e -> m () warnWith :: MonadDiagnostic e m => [Diagnostic e] -> [Rendering] -> e -> m () noteWith :: MonadDiagnostic e m => [Diagnostic e] -> [Rendering] -> e -> m () verboseWith :: MonadDiagnostic e m => Int -> [Diagnostic e] -> [Rendering] -> e -> m () -- | The unlocated error type used internally within the parser. module Text.Trifecta.Diagnostic.Err -- | unlocated error data Err e EmptyErr :: Err e FailErr :: String -> Err e PanicErr :: String -> Err e Err :: [Rendering] -> !DiagnosticLevel -> e -> [Diagnostic e] -> Err e knownErr :: Err e -> Bool fatalErr :: Err e -> Bool instance Show e => Show (Err e) instance Monoid (Err t) instance Semigroup (Err t) instance Plus Err instance Alt Err instance Traversable Err instance Foldable Err instance Functor Err module Text.Trifecta.Parser.Class class (Alternative m, MonadPlus m) => MonadParser m try :: MonadParser m => m a -> m a labels :: MonadParser m => m a -> [String] -> m a skipMany :: MonadParser m => m a -> m () satisfy :: MonadParser m => (Char -> Bool) -> m Char satisfy8 :: MonadParser m => (Word8 -> Bool) -> m Word8 highlight :: MonadParser m => Highlight -> m a -> m a liftIt :: MonadParser m => It Rope a -> m a mark :: MonadParser m => m Delta unexpected :: (MonadParser m, MonadParser m) => String -> m a line :: MonadParser m => m ByteString release :: MonadParser m => Delta -> m () satisfyAscii :: MonadParser m => (Char -> Bool) -> m Char -- | grab the remainder of the current line restOfLine :: MonadParser m => m ByteString -- | label a parser with a name () :: MonadParser m => m a -> String -> m a skipping :: MonadParser m => Delta -> m () -- | run a parser, grabbing all of the text between its start and end -- points slicedWith :: MonadParser m => (a -> ByteString -> r) -> m a -> m r -- | run a parser, grabbing all of the text between its start and end -- points and discarding the original result sliced :: MonadParser m => m a -> m ByteString rend :: MonadParser m => m Rendering instance MonadParser m => MonadParser (Yoneda m) instance MonadParser m => MonadParser (IdentityT m) instance (MonadParser m, Monoid w) => MonadParser (RWST r w s m) instance (MonadParser m, Monoid w) => MonadParser (RWST r w s m) instance (MonadParser m, Monoid w) => MonadParser (WriterT w m) instance (MonadParser m, Monoid w) => MonadParser (WriterT w m) instance MonadParser m => MonadParser (ReaderT e m) instance MonadParser m => MonadParser (StateT s m) instance MonadParser m => MonadParser (StateT s m) module Text.Trifecta.Diagnostic.Rendering.Caret -- |
--   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; }
--                                      ^
--   
data Caret Caret :: !Delta -> {-# UNPACK #-} !ByteString -> Caret caret :: MonadParser m => m Caret data Careted a (:^) :: a -> Caret -> Careted a careted :: MonadParser m => m a -> m (Careted a) drawCaret :: Delta -> Delta -> Lines -> Lines addCaret :: Delta -> Rendering -> Rendering caretEffects :: [ScopedEffect] instance Eq Caret instance Ord Caret instance Show Caret instance Eq a => Eq (Careted a) instance Ord a => Ord (Careted a) instance Show a => Show (Careted a) instance Hashable a => Hashable (Careted a) instance Reducer (Careted a) Rendering instance Renderable (Careted a) instance Traversable1 Careted instance Foldable1 Careted instance Traversable Careted instance Foldable Careted instance Comonad Careted instance HasBytes (Careted a) instance HasDelta (Careted a) instance Extend Careted instance Functor Careted instance Semigroup Caret instance Reducer Caret Rendering instance Renderable Caret instance HasDelta Caret instance HasBytes Caret instance Hashable Caret module Text.Trifecta.Diagnostic.Err.State data ErrState e ErrState :: !Set (Careted String) -> !Err e -> ErrState e errExpected :: ErrState e -> !Set (Careted String) errMessage :: ErrState e -> !Err e instance Monoid (ErrState e) instance Semigroup (ErrState e) instance Plus ErrState instance Alt ErrState instance Functor ErrState module Text.Trifecta.Diagnostic.Rendering.Span data Span Span :: !Delta -> !Delta -> {-# UNPACK #-} !ByteString -> Span span :: MonadParser m => m a -> m Span data Spanned a (:~) :: a -> Span -> Spanned a spanned :: MonadParser m => m a -> m (Spanned a) spanEffects :: [ScopedEffect] drawSpan :: Delta -> Delta -> Delta -> Lines -> Lines -- |
--   int main(int argc, char ** argv) { int; }
--                                      ^~~
--   
addSpan :: Delta -> Delta -> Rendering -> Rendering instance Eq Span instance Ord Span instance Show Span instance Eq a => Eq (Spanned a) instance Ord a => Ord (Spanned a) instance Show a => Show (Spanned a) instance Hashable a => Hashable (Spanned a) instance Hashable Span instance Renderable (Spanned a) instance Reducer (Spanned a) Rendering instance Traversable1 Spanned instance Foldable1 Spanned instance Traversable Spanned instance Foldable Spanned instance Bind Spanned instance Apply Spanned instance Comonad Spanned instance Extend Spanned instance Functor Spanned instance Reducer Span Rendering instance Semigroup Span instance Renderable Span module Text.Trifecta.Diagnostic.Rendering.Fixit data Fixit Fixit :: {-# UNPACK #-} !Span -> {-# UNPACK #-} !ByteString -> Fixit fixitSpan :: Fixit -> {-# UNPACK #-} !Span fixitReplacement :: Fixit -> {-# UNPACK #-} !ByteString -- |
--   int main(int argc char ** argv) { int; }
--                    ^
--                    ,
--   
drawFixit :: Delta -> Delta -> String -> Delta -> Lines -> Lines addFixit :: Delta -> Delta -> String -> Rendering -> Rendering fixit :: MonadParser m => m ByteString -> m Fixit instance Eq Fixit instance Ord Fixit instance Show Fixit instance Renderable Fixit instance Reducer Fixit Rendering instance Hashable Fixit module Text.Trifecta.Diagnostic.Rendering class Renderable t render :: Renderable t => t -> Rendering class Source t -- | create a drawing surface rendering :: Source s => Delta -> s -> Rendering -- |
--   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; }
--                                      ^
--   
data Caret Caret :: !Delta -> {-# UNPACK #-} !ByteString -> Caret data Careted a (:^) :: a -> Caret -> Careted a data Span Span :: !Delta -> !Delta -> {-# UNPACK #-} !ByteString -> Span data Spanned a (:~) :: a -> Span -> Spanned a data Fixit Fixit :: {-# UNPACK #-} !Span -> {-# UNPACK #-} !ByteString -> Fixit fixitSpan :: Fixit -> {-# UNPACK #-} !Span fixitReplacement :: Fixit -> {-# UNPACK #-} !ByteString data Rendered a (:@) :: a -> Rendering -> Rendered a -- | Commonly used generic combinators module Text.Trifecta.Parser.Combinators -- | choice ps tries to apply the parsers in the list ps -- in order, until one of them succeeds. Returns the value of the -- succeeding parser. choice :: Alternative m => [m a] -> m a -- | option x p tries to apply parser p. If p -- fails without consuming input, it returns the value x, -- otherwise the value returned by p. -- --
--   priority  = option 0 (do{ d <- digit
--                           ; return (digitToInt d) 
--                           })
--   
option :: Alternative m => a -> m a -> m a -- | One or none. optional :: Alternative f => f a -> f (Maybe a) -- | skipOptional p tries to apply parser p. It will -- parse p or nothing. It only fails if p fails after -- consuming input. It discards the result of p. (Plays the role -- of parsec's optional, which conflicts with Applicative's optional) skipOptional :: Alternative m => m a -> m () -- | between open close p parses open, followed by -- p and close. Returns the value returned by -- p. -- --
--   braces  = between (symbol "{") (symbol "}")
--   
between :: Applicative m => m bra -> m ket -> m a -> m a -- | skipSome p applies the parser p one or more -- times, skipping its result. (aka skipMany1 in parsec) skipSome :: MonadParser m => m a -> m () -- | One or more. some :: Alternative f => forall a. f a -> f [a] -- | Zero or more. many :: Alternative f => forall a. f a -> f [a] -- | sepBy p sep parses zero or more occurrences of -- p, separated by sep. Returns a list of values -- returned by p. -- --
--   commaSep p  = p `sepBy` (symbol ",")
--   
sepBy :: Alternative m => m a -> m sep -> m [a] -- | sepBy1 p sep parses one or more occurrences of -- p, separated by sep. Returns a list of values -- returned by p. sepBy1 :: Alternative m => m a -> m sep -> m [a] -- | sepEndBy1 p sep parses one or more occurrences of -- p, separated and optionally ended by sep. Returns a -- list of values returned by p. sepEndBy1 :: Alternative m => m a -> m sep -> m [a] -- | sepEndBy p sep parses zero or more occurrences of -- p, separated and optionally ended by sep, ie. -- haskell style statements. Returns a list of values returned by -- p. -- --
--   haskellStatements  = haskellStatement `sepEndBy` semi
--   
sepEndBy :: Alternative m => m a -> m sep -> m [a] -- | endBy1 p sep parses one or more occurrences of -- p, seperated and ended by sep. Returns a list of -- values returned by p. endBy1 :: Alternative m => m a -> m sep -> m [a] -- | endBy p sep parses zero or more occurrences of -- p, seperated and ended by sep. Returns a list of -- values returned by p. -- --
--   cStatements  = cStatement `endBy` semi
--   
endBy :: Alternative m => m a -> m sep -> m [a] -- | count n p parses n occurrences of p. If -- n is smaller or equal to zero, the parser equals to -- return []. Returns a list of n values returned by -- p. count :: Applicative m => Int -> m a -> m [a] -- | chainl p op x parser zero or more occurrences of -- p, separated by op. Returns a value obtained by a -- left associative application of all functions returned by -- op to the values returned by p. If there are zero -- occurrences of p, the value x is returned. chainl :: Alternative m => m a -> m (a -> a -> a) -> a -> m a -- | chainr p op x parser zero or more occurrences of -- p, separated by op Returns a value obtained by a -- right associative application of all functions returned by -- op to the values returned by p. If there are no -- occurrences of p, the value x is returned. chainr :: Alternative m => m a -> m (a -> a -> a) -> a -> m a -- | chainl1 p op x parser one or more occurrences of -- p, separated by op Returns a value obtained by a -- left associative application of all functions returned by -- op to the values returned by p. . This parser can -- for example be used to eliminate left recursion which typically occurs -- in expression grammars. -- --
--   expr    = term   `chainl1` addop
--   term    = factor `chainl1` mulop
--   factor  = parens expr <|> integer
--   
--   mulop   =   do{ symbol "*"; return (*)   }
--           <|> do{ symbol "/"; return (div) }
--   
--   addop   =   do{ symbol "+"; return (+) }
--           <|> do{ symbol "-"; return (-) }
--   
chainl1 :: Alternative m => m a -> m (a -> a -> a) -> m a -- | chainr1 p op x parser one or more occurrences of |p|, -- separated by op Returns a value obtained by a right -- associative application of all functions returned by op to -- the values returned by p. chainr1 :: Alternative m => m a -> m (a -> a -> a) -> m a -- | This parser only succeeds at the end of the input. This is not a -- primitive parser but it is defined using notFollowedBy. -- --
--   eof  = notFollowedBy anyChar <?> "end of input"
--   
eof :: MonadParser m => m () -- | manyTill p end applies parser p zero or more -- times until parser end succeeds. Returns the list of values -- returned by p. This parser can be used to scan comments: -- --
--   simpleComment   = do{ string "<!--"
--                       ; manyTill anyChar (try (string "-->"))
--                       }
--   
-- -- Note the overlapping parsers anyChar and string -- "-->", and therefore the use of the try combinator. manyTill :: (Alternative m, MonadPlus m) => m a -> m end -> m [a] -- | notFollowedBy p only succeeds when parser p fails. -- This parser does not consume any input. This parser can be used to -- implement the 'longest match' rule. For example, when recognizing -- keywords (for example let), we want to make sure that a -- keyword is not followed by a legal identifier character, in which case -- the keyword is actually an identifier (for example lets). We -- can program this behaviour as follows: -- --
--   keywordLet  = try (do{ string "let"
--                        ; notFollowedBy alphaNum
--                        })
--   
notFollowedBy :: (MonadParser m, Show a) => m a -> m () -- | lookAhead p parses p without consuming any input. lookAhead :: MonadParser m => m a -> m a -- | This module implements permutation parsers. The algorithm is described -- in: -- -- Parsing Permutation Phrases, by Arthur Baars, Andres Loh and -- Doaitse Swierstra. Published as a functional pearl at the Haskell -- Workshop 2001. module Text.Trifecta.Parser.Perm -- | The type Perm m a denotes a permutation parser that, when -- converted by the permute function, parses using the base -- parsing monad m and returns a value of type a on -- success. -- -- Normally, a permutation parser is first build with special operators -- like (<||>) and than transformed into a normal parser -- using permute. data Perm m a -- | The parser permute perm parses a permutation of parser -- described by perm. For example, suppose we want to parse a -- permutation of: an optional string of a's, the character -- b and an optional c. This can be described by: -- --
--   test  = permute (tuple <$?> ("",some (char 'a'))
--                          <||> char 'b' 
--                          <|?> ('_',char 'c'))
--         where
--           tuple a b c  = (a,b,c)
--   
permute :: Alternative m => Perm m a -> m a -- | The expression perm <||> p adds parser p to -- the permutation parser perm. The parser p is not -- allowed to accept empty input - use the optional combinator -- (<|?>) instead. Returns a new permutation parser that -- includes p. (<||>) :: Functor m => Perm m (a -> b) -> m a -> Perm m b -- | The expression f <$$> p creates a fresh permutation -- parser consisting of parser p. The the final result of the -- permutation parser is the function f applied to the return -- value of p. The parser p is not allowed to accept -- empty input - use the optional combinator (<$?>) instead. -- -- If the function f takes more than one parameter, the type -- variable b is instantiated to a functional type which -- combines nicely with the adds parser p to the -- (<||>) combinator. This results in stylized code where a -- permutation parser starts with a combining function f -- followed by the parsers. The function f gets its parameters -- in the order in which the parsers are specified, but actual input can -- be in any order. (<$$>) :: Functor m => (a -> b) -> m a -> Perm m b -- | The expression perm <||> (x,p) adds parser p -- to the permutation parser perm. The parser p is -- optional - if it can not be applied, the default value x will -- be used instead. Returns a new permutation parser that includes the -- optional parser p. (<|?>) :: Functor m => Perm m (a -> b) -> (a, m a) -> Perm m b -- | The expression f <$?> (x,p) creates a fresh permutation -- parser consisting of parser p. The the final result of the -- permutation parser is the function f applied to the return -- value of p. The parser p is optional - if it can not -- be applied, the default value x will be used instead. (<$?>) :: Functor m => (a -> b) -> (a, m a) -> Perm m b instance Functor m => Functor (Branch m) instance Functor m => Functor (Perm m) -- | A helper module to parse "expressions". Builds a parser given a table -- of operators and associativities. module Text.Trifecta.Parser.Expr -- | This data type specifies the associativity of operators: left, right -- or none. data Assoc AssocNone :: Assoc AssocLeft :: Assoc AssocRight :: Assoc -- | This data type specifies operators that work on values of type -- a. An operator is either binary infix or unary prefix or -- postfix. A binary operator has also an associated associativity. data Operator m a Infix :: (m (a -> a -> a)) -> Assoc -> Operator m a Prefix :: (m (a -> a)) -> Operator m a Postfix :: (m (a -> a)) -> Operator m a -- | An OperatorTable m a is a list of Operator m a -- lists. The list is ordered in descending precedence. All operators in -- one list have the same precedence (but may have a different -- associativity). type OperatorTable m a = [[Operator m a]] -- | buildExpressionParser table term builds an expression parser -- for terms term with operators from table, taking the -- associativity and precedence specified in table into account. -- Prefix and postfix operators of the same precedence can only occur -- once (i.e. --2 is not allowed if - is prefix -- negate). Prefix and postfix operators of the same precedence associate -- to the left (i.e. if ++ is postfix increment, than -- -2++ equals -1, not -3). -- -- The buildExpressionParser takes care of all the complexity -- involved in building expression parser. Here is an example of an -- expression parser that handles prefix signs, postfix increment and -- basic arithmetic. -- --
--   expr    = buildExpressionParser table term
--           <?> "expression"
--   
--   term    =  parens expr 
--           <|> natural
--           <?> "simple expression"
--   
--   table   = [ [prefix "-" negate, prefix "+" id ]
--             , [postfix "++" (+1)]
--             , [binary "*" (*) AssocLeft, binary "/" (div) AssocLeft ]
--             , [binary "+" (+) AssocLeft, binary "-" (-)   AssocLeft ]
--             ]
--           
--   binary  name fun assoc = Infix (do{ reservedOp name; return fun }) assoc
--   prefix  name fun       = Prefix (do{ reservedOp name; return fun })
--   postfix name fun       = Postfix (do{ reservedOp name; return fun })
--   
buildExpressionParser :: MonadParser m => OperatorTable m a -> m a -> m a module Text.Trifecta.Parser.Token.Class class MonadParser m => MonadTokenParser m whiteSpace :: MonadTokenParser m => m () nesting :: MonadTokenParser m => m a -> m a semi :: MonadTokenParser m => m Char instance MonadTokenParser m => MonadTokenParser (IdentityT m) instance (MonadTokenParser m, Monoid w) => MonadTokenParser (RWST r w s m) instance (MonadTokenParser m, Monoid w) => MonadTokenParser (RWST r w s m) instance (MonadTokenParser m, Monoid w) => MonadTokenParser (WriterT w m) instance (MonadTokenParser m, Monoid w) => MonadTokenParser (WriterT w m) instance MonadTokenParser m => MonadTokenParser (StateT s m) instance MonadTokenParser m => MonadTokenParser (StateT s m) instance MonadTokenParser m => MonadTokenParser (ReaderT r m) module Text.Trifecta.Parser.Layout.Prim data LayoutToken VirtualSemi :: LayoutToken VirtualRightBrace :: LayoutToken WhiteSpace :: LayoutToken Other :: LayoutToken data LayoutState LayoutState :: Bool -> [LayoutContext] -> LayoutState _layoutBol :: LayoutState -> Bool _layoutStack :: LayoutState -> [LayoutContext] data LayoutContext IndentedLayout :: Rendering -> LayoutContext DisabledLayout :: Rendering -> LayoutContext defaultLayoutState :: LayoutState layoutBol :: Lens LayoutState Bool layoutStack :: Lens LayoutState [LayoutContext] instance Eq LayoutToken instance Ord LayoutToken instance Show LayoutToken instance Read LayoutToken instance HasBytes LayoutContext instance HasDelta LayoutContext module Text.Trifecta.Parser.Layout.Class class MonadTokenParser m => MonadLayoutParser m layout :: MonadLayoutParser m => m LayoutToken getLayout :: MonadLayoutParser m => Lens LayoutState t -> m t setLayout :: MonadLayoutParser m => Lens LayoutState t -> t -> m () modLayout :: MonadLayoutParser m => Lens LayoutState t -> (t -> t) -> m () instance MonadLayoutParser m => MonadLayoutParser (IdentityT m) instance (Monoid w, MonadLayoutParser m) => MonadLayoutParser (RWST r w s m) instance (Monoid w, MonadLayoutParser m) => MonadLayoutParser (RWST r w s m) instance (Monoid w, MonadLayoutParser m) => MonadLayoutParser (WriterT w m) instance (Monoid w, MonadLayoutParser m) => MonadLayoutParser (WriterT w m) instance MonadLayoutParser m => MonadLayoutParser (ReaderT e m) instance MonadLayoutParser m => MonadLayoutParser (StateT s m) instance MonadLayoutParser m => MonadLayoutParser (StateT s m) module Text.Trifecta.Parser.Prim data Parser e a Parser :: (forall r. (a -> ErrState e -> ErrLog e -> Bool -> Delta -> ByteString -> It Rope r) -> (ErrState e -> ErrLog e -> Bool -> Delta -> ByteString -> It Rope r) -> (a -> ErrState e -> ErrLog e -> Bool -> Delta -> ByteString -> It Rope r) -> (ErrState e -> ErrLog e -> Bool -> Delta -> ByteString -> It Rope r) -> ErrLog e -> Bool -> Delta -> ByteString -> It Rope r) -> Parser e a unparser :: Parser e a -> forall r. (a -> ErrState e -> ErrLog e -> Bool -> Delta -> ByteString -> It Rope r) -> (ErrState e -> ErrLog e -> Bool -> Delta -> ByteString -> It Rope r) -> (a -> ErrState e -> ErrLog e -> Bool -> Delta -> ByteString -> It Rope r) -> (ErrState e -> ErrLog e -> Bool -> Delta -> ByteString -> It Rope r) -> ErrLog e -> Bool -> Delta -> ByteString -> It Rope r why :: Pretty e => (e -> Doc t) -> ErrState e -> Highlights -> Bool -> Delta -> ByteString -> Diagnostic (Doc t) stepParser :: (Diagnostic e -> Diagnostic t) -> (ErrState e -> Highlights -> Bool -> Delta -> ByteString -> Diagnostic t) -> Parser e a -> ErrLog e -> Bool -> Delta -> ByteString -> Step t a parseTest :: Show a => Parser String a -> String -> IO () manyAccum :: (a -> [a] -> [a]) -> Parser e a -> Parser e [a] instance MonadParser (Parser e) instance MonadError (ErrState e) (Parser e) instance MonadDiagnostic e (Parser e) instance MonadWriter (ErrLog e) (Parser e) instance MonadPlus (Parser e) instance Monad (Parser e) instance Bind (Parser e) instance Monoid (Parser e a) instance Semigroup (Parser e a) instance Alternative (Parser e) instance Plus (Parser e) instance Alt (Parser e) instance Applicative (Parser e) instance Apply (Parser e) instance Functor (Parser e) -- | Loading a file as a strict bytestring in one step. module Text.Trifecta.Parser.ByteString -- | parseFromFile p filePath runs a parser p on the -- input read from filePath using ByteString.readFile. -- All diagnostic messages emitted over the course of the parse attempt -- are shown to the user on the console. -- --
--   main = do
--     result <- parseFromFile numbers "digits.txt"
--     case result of
--       Nothing -> return ()
--       Just a  -> print $ sum a
--   
parseFromFile :: Show a => Parser String a -> String -> IO (Maybe a) -- | parseFromFileEx p filePath runs a parser p on the -- input read from filePath using ByteString.readFile. -- Returns all diagnostic messages emitted over the course of the parse -- and the answer if the parse was successful. -- --
--   main = do
--     result <- parseFromFileEx (many number) "digits.txt"
--     case result of
--       Failure xs -> unless (Seq.null xs) $ displayLn xs
--       Success xs a  -> 
--         unless (Seq.null xs) $ displayLn xs
--         print $ sum a
--   
parseFromFileEx :: Show a => Parser String a -> String -> IO (Result TermDoc a) -- | Fast set membership tests for byte values, The set representation is -- unboxed for efficiency and uses a lookup table. This is a fairly -- minimal API. You probably want to use CharSet. module Text.Trifecta.ByteSet newtype ByteSet ByteSet :: ByteString -> ByteSet fromList :: [Word8] -> ByteSet -- | Check the set for membership. member :: Word8 -> ByteSet -> Bool instance Eq ByteSet instance Ord ByteSet instance Show ByteSet -- | Fast set membership tests for Char values -- -- Stored as a (possibly negated) IntMap and a fast set used for the head -- byte. -- -- The set of valid (possibly negated) head bytes is stored unboxed as a -- 32-byte bytestring-based lookup table. -- -- Designed to be imported qualified: -- --
--   import Text.Trifecta.CharSet (CharSet)
--   import qualified Text.Trifecta.CharSet as CharSet
--   
module Text.Trifecta.CharSet data CharSet CharSet :: !Bool -> {-# UNPACK #-} !ByteSet -> !IntSet -> CharSet (\\) :: CharSet -> CharSet -> CharSet -- | O(n) worst case null :: CharSet -> Bool -- | O(n) size :: CharSet -> Int member :: Char -> CharSet -> Bool notMember :: Char -> CharSet -> Bool overlaps :: CharSet -> CharSet -> Bool isSubsetOf :: CharSet -> CharSet -> Bool isComplemented :: CharSet -> Bool build :: (Char -> Bool) -> CharSet empty :: CharSet singleton :: Char -> CharSet full :: CharSet insert :: Char -> CharSet -> CharSet delete :: Char -> CharSet -> CharSet complement :: CharSet -> CharSet range :: Char -> Char -> CharSet union :: CharSet -> CharSet -> CharSet intersection :: CharSet -> CharSet -> CharSet difference :: CharSet -> CharSet -> CharSet filter :: (Char -> Bool) -> CharSet -> CharSet partition :: (Char -> Bool) -> CharSet -> (CharSet, CharSet) map :: (Char -> Char) -> CharSet -> CharSet fold :: (Char -> b -> b) -> b -> CharSet -> b toList :: CharSet -> String fromList :: String -> CharSet toAscList :: CharSet -> String fromAscList :: String -> CharSet fromDistinctAscList :: String -> CharSet fromCharSet :: CharSet -> (Bool, IntSet) toCharSet :: IntSet -> CharSet toArray :: CharSet -> UArray Char Bool instance Monoid CharSet instance Semigroup CharSet instance Read CharSet instance Show CharSet instance Bounded CharSet instance Ord CharSet instance Eq CharSet instance Data CharSet instance Typeable CharSet -- | The various character classifications from Data.Char as -- CharSets module Text.Trifecta.CharSet.Common control, asciiLower, asciiUpper, latin1, ascii, separator, symbol, punctuation, number, mark, letter, octDigit, digit, print, alphaNum, alpha, upper, lower, space :: CharSet module Text.Trifecta.CharSet.Posix.Ascii posixAscii :: HashMap String CharSet lookupPosixAsciiCharSet :: String -> Maybe CharSet alnum, xdigit, lower, upper, space, punct, word, print, graph, digit, cntrl, blank, ascii, alpha :: CharSet -- | Provides unicode general categories, which are typically connoted by -- p{Ll} or p{Modifier_Letter}. Lookups can be -- constructed using categories or individual character sets can -- be used directly. module Text.Trifecta.CharSet.Unicode data UnicodeCategory UnicodeCategory :: String -> String -> CharSet -> String -> UnicodeCategory unicodeCategories :: [UnicodeCategory] lowercaseLetter, letter, otherLetter, modifierLetter, letterAnd, titlecaseLetter, uppercaseLetter :: CharSet nonSpacingMark, mark, enclosingMark, spacingCombiningMark :: CharSet space, separator, paragraphSeparator, lineSeparator :: CharSet mathSymbol, symbol, otherSymbol, modifierSymbol, currencySymbol :: CharSet decimalNumber, number, otherNumber, letterNumber :: CharSet dashPunctuation, punctuation, otherPunctuation, connectorPunctuation, finalQuote, initialQuote, closePunctuation, openPunctuation :: CharSet control, other, notAssigned, surrogate, privateUse, format :: CharSet instance Typeable UnicodeCategory instance Show UnicodeCategory instance Data UnicodeCategory -- | Provides unicode general categories, which are typically connoted by -- p{Ll} or p{Modifier_Letter}. Lookups can be -- constructed using categories or individual character sets can -- be used directly. -- -- A case, _ and - insensitive lookup is provided by -- lookupCategory and can be used to provide behavior similar to -- that of Perl or PCRE. module Text.Trifecta.CharSet.Unicode.Category data Category Category :: String -> String -> CharSet -> String -> Category categoryName :: Category -> String categoryAbbreviation :: Category -> String categoryCharSet :: Category -> CharSet categoryDescription :: Category -> String categories :: [Category] lookupCategory :: String -> Maybe Category lookupCategoryCharSet :: String -> Maybe CharSet lowercaseLetter, letter, otherLetter, modifierLetter, letterAnd, titlecaseLetter, uppercaseLetter :: CharSet nonSpacingMark, mark, enclosingMark, spacingCombiningMark :: CharSet space, separator, paragraphSeparator, lineSeparator :: CharSet mathSymbol, symbol, otherSymbol, modifierSymbol, currencySymbol :: CharSet decimalNumber, number, otherNumber, letterNumber :: CharSet dashPunctuation, punctuation, otherPunctuation, connectorPunctuation, finalQuote, initialQuote, closePunctuation, openPunctuation :: CharSet control, other, notAssigned, surrogate, privateUse, format :: CharSet instance Typeable Category instance Show Category instance Data Category -- | Provides unicode general categories, which are typically connoted by -- p{InBasicLatin} or p{InIPA_Extensions}. Lookups can -- be constructed using categories or individual character sets -- can be used directly. module Text.Trifecta.CharSet.Unicode.Block data Block Block :: String -> CharSet -> Block blockName :: Block -> String blockCharSet :: Block -> CharSet blocks :: [Block] lookupBlock :: String -> Maybe Block lookupBlockCharSet :: String -> Maybe CharSet basicLatin :: CharSet latin1Supplement :: CharSet latinExtendedA :: CharSet latinExtendedB :: CharSet ipaExtensions :: CharSet spacingModifierLetters :: CharSet combiningDiacriticalMarks :: CharSet greekAndCoptic :: CharSet cyrillic :: CharSet cyrillicSupplementary :: CharSet armenian :: CharSet hebrew :: CharSet arabic :: CharSet syriac :: CharSet thaana :: CharSet devanagari :: CharSet bengali :: CharSet gurmukhi :: CharSet gujarati :: CharSet oriya :: CharSet tamil :: CharSet telugu :: CharSet kannada :: CharSet malayalam :: CharSet sinhala :: CharSet thai :: CharSet lao :: CharSet tibetan :: CharSet myanmar :: CharSet georgian :: CharSet hangulJamo :: CharSet ethiopic :: CharSet cherokee :: CharSet unifiedCanadianAboriginalSyllabics :: CharSet ogham :: CharSet runic :: CharSet tagalog :: CharSet hanunoo :: CharSet buhid :: CharSet tagbanwa :: CharSet khmer :: CharSet mongolian :: CharSet limbu :: CharSet taiLe :: CharSet khmerSymbols :: CharSet phoneticExtensions :: CharSet latinExtendedAdditional :: CharSet greekExtended :: CharSet generalPunctuation :: CharSet superscriptsAndSubscripts :: CharSet currencySymbols :: CharSet combiningDiacriticalMarksForSymbols :: CharSet letterlikeSymbols :: CharSet numberForms :: CharSet arrows :: CharSet mathematicalOperators :: CharSet miscellaneousTechnical :: CharSet controlPictures :: CharSet opticalCharacterRecognition :: CharSet enclosedAlphanumerics :: CharSet boxDrawing :: CharSet blockElements :: CharSet geometricShapes :: CharSet miscellaneousSymbols :: CharSet dingbats :: CharSet miscellaneousMathematicalSymbolsA :: CharSet supplementalArrowsA :: CharSet braillePatterns :: CharSet supplementalArrowsB :: CharSet miscellaneousMathematicalSymbolsB :: CharSet supplementalMathematicalOperators :: CharSet miscellaneousSymbolsAndArrows :: CharSet cjkRadicalsSupplement :: CharSet kangxiRadicals :: CharSet ideographicDescriptionCharacters :: CharSet cjkSymbolsAndPunctuation :: CharSet hiragana :: CharSet katakana :: CharSet bopomofo :: CharSet hangulCompatibilityJamo :: CharSet kanbun :: CharSet bopomofoExtended :: CharSet katakanaPhoneticExtensions :: CharSet enclosedCjkLettersAndMonths :: CharSet cjkCompatibility :: CharSet cjkUnifiedIdeographsExtensionA :: CharSet yijingHexagramSymbols :: CharSet cjkUnifiedIdeographs :: CharSet yiSyllables :: CharSet yiRadicals :: CharSet hangulSyllables :: CharSet highSurrogates :: CharSet highPrivateUseSurrogates :: CharSet lowSurrogates :: CharSet privateUseArea :: CharSet cjkCompatibilityIdeographs :: CharSet alphabeticPresentationForms :: CharSet arabicPresentationFormsA :: CharSet variationSelectors :: CharSet combiningHalfMarks :: CharSet cjkCompatibilityForms :: CharSet smallFormVariants :: CharSet arabicPresentationFormsB :: CharSet halfwidthAndFullwidthForms :: CharSet specials :: CharSet instance Typeable Block instance Show Block instance Data Block module Text.Trifecta.CharSet.Posix.Unicode posixUnicode :: HashMap String CharSet lookupPosixUnicodeCharSet :: String -> Maybe CharSet alnum, xdigit, lower, upper, space, punct, word, print, graph, digit, cntrl, blank, ascii, alpha :: CharSet module Text.Trifecta.CharSet.Posix posixAscii :: HashMap String CharSet lookupPosixAsciiCharSet :: String -> Maybe CharSet posixUnicode :: HashMap String CharSet lookupPosixUnicodeCharSet :: String -> Maybe CharSet module Text.Trifecta.Parser.Char -- | oneOf cs succeeds if the current character is in the supplied -- list of characters cs. Returns the parsed character. See also -- satisfy. -- --
--   vowel  = oneOf "aeiou"
--   
oneOf :: MonadParser m => [Char] -> m Char -- | As the dual of oneOf, noneOf cs succeeds if the -- current character not in the supplied list of characters -- cs. Returns the parsed character. -- --
--   consonant = noneOf "aeiou"
--   
noneOf :: MonadParser m => [Char] -> m Char -- | oneOfSet cs succeeds if the current character is in the -- supplied set of characters cs. Returns the parsed character. -- See also satisfy. -- --
--   vowel  = oneOf "aeiou"
--   
oneOfSet :: MonadParser m => CharSet -> m Char -- | As the dual of oneOf, noneOf cs succeeds if the -- current character not in the supplied list of characters -- cs. Returns the parsed character. -- --
--   consonant = noneOf "aeiou"
--   
noneOfSet :: MonadParser m => CharSet -> m Char -- | Skips zero or more white space characters. See also -- skipMany and whiteSpace. spaces :: MonadParser m => m () -- | Parses a white space character (any character which satisfies -- isSpace) Returns the parsed character. space :: MonadParser m => m Char -- | Parses a newline character ('\n'). Returns a newline character. newline :: MonadParser m => m Char -- | Parses a tab character ('\t'). Returns a tab character. tab :: MonadParser m => m Char -- | Parses an upper case letter (a character between 'A' and 'Z'). Returns -- the parsed character. upper :: MonadParser m => m Char -- | Parses a lower case character (a character between 'a' and 'z'). -- Returns the parsed character. lower :: MonadParser m => m Char -- | Parses a letter or digit (a character between '0' and '9'). Returns -- the parsed character. alphaNum :: MonadParser m => m Char -- | Parses a letter (an upper case or lower case character). Returns the -- parsed character. letter :: MonadParser m => m Char -- | Parses a digit. Returns the parsed character. digit :: MonadParser m => m Char -- | Parses a hexadecimal digit (a digit or a letter between 'a' and 'f' or -- 'A' and 'F'). Returns the parsed character. hexDigit :: MonadParser m => m Char -- | Parses an octal digit (a character between '0' and '7'). Returns the -- parsed character. octDigit :: MonadParser m => m Char -- | char c parses a single character c. Returns the -- parsed character (i.e. c). -- --
--   semiColon  = char ';'
--   
char :: MonadParser m => Char -> m Char -- | notChar c parses any single character other than c. -- Returns the parsed character. -- --
--   semiColon  = char ';'
--   
notChar :: MonadParser m => Char -> m Char -- | This parser succeeds for any character. Returns the parsed character. anyChar :: MonadParser m => m Char -- | string s parses a sequence of characters given by s. -- Returns the parsed string (i.e. s). -- --
--   divOrMod    =   string "div" 
--               <|> string "mod"
--   
string :: MonadParser m => String -> m String -- | byteString s parses a sequence of bytes given by s. -- Returns the parsed byteString (i.e. s). -- --
--   divOrMod    =   string "div" 
--               <|> string "mod"
--   
byteString :: MonadParser m => ByteString -> m ByteString module Text.Trifecta.Parser.Token.Style data CommentStyle CommentStyle :: String -> String -> String -> Bool -> CommentStyle commentStart :: CommentStyle -> String commentEnd :: CommentStyle -> String commentLine :: CommentStyle -> String commentNesting :: CommentStyle -> Bool emptyCommentStyle, haskellCommentStyle, javaCommentStyle :: CommentStyle -- | Use this to easily build the definition of whiteSpace for your -- MonadTokenParser buildWhiteSpaceParser :: MonadParser m => CommentStyle -> m () module Text.Trifecta.Parser.Token.Prim -- | This parser parses a single literal character. Returns the literal -- character value. This parsers deals correctly with escape sequences. -- The literal character is parsed according to the grammar rules defined -- in the Haskell report (which matches most programming languages quite -- closely). -- -- This parser does NOT swallow trailing whitespace. charLiteral' :: MonadParser m => m Char characterChar :: MonadParser m => m Char -- | This parser parses a literal string. Returns the literal string value. -- This parsers deals correctly with escape sequences and gaps. The -- literal string is parsed according to the grammar rules defined in the -- Haskell report (which matches most programming languages quite -- closely). -- -- This parser does NOT swallow trailing whitespace stringLiteral' :: MonadParser m => m String -- | This parser parses a natural number (a positive whole number). Returns -- the value of the number. The number can be specified in -- decimal, hexadecimal or octal. The number is -- parsed according to the grammar rules in the Haskell report. -- -- This parser does NOT swallow trailing whitespace. natural' :: MonadParser m => m Integer -- | This parser parses an integer (a whole number). This parser is like -- natural except that it can be prefixed with sign (i.e. '-' or -- '+'). Returns the value of the number. The number can be specified in -- decimal, hexadecimal or octal. The number is -- parsed according to the grammar rules in the Haskell report. -- -- This parser does NOT swallow trailing whitespace. -- -- Also, unlike the integer parser, this parser does not admit -- spaces between the sign and the number. integer' :: MonadParser m => m Integer -- | This parser parses a floating point value. Returns the value of the -- number. The number is parsed according to the grammar rules defined in -- the Haskell report. -- -- This parser does NOT swallow trailing whitespace. double' :: MonadParser m => m Double -- | This parser parses either natural or a double. -- Returns the value of the number. This parsers deals with any overlap -- in the grammar rules for naturals and floats. The number is parsed -- according to the grammar rules defined in the Haskell report. -- -- This parser does NOT swallow trailing whitespace. naturalOrDouble' :: MonadParser m => m (Either Integer Double) -- | Parses a positive whole number in the decimal system. Returns the -- value of the number. decimal :: MonadParser m => m Integer -- | Parses a positive whole number in the hexadecimal system. The number -- should be prefixed with "x" or "X". Returns the value of the number. hexadecimal :: MonadParser m => m Integer -- | Parses a positive whole number in the octal system. The number should -- be prefixed with "o" or "O". Returns the value of the number. octal :: MonadParser m => m Integer module Text.Trifecta.Parser.Token.Combinators -- | lexeme p first applies parser p and then the -- whiteSpace parser, returning the value of p. Every -- lexical token (lexeme) is defined using lexeme, this way -- every parse starts at a point without white space. Parsers that use -- lexeme are called lexeme parsers in this document. -- -- The only point where the whiteSpace parser should be called -- explicitly is the start of the main parser in order to skip any -- leading white space. -- --
--   mainParser  = do { whiteSpace
--                    ; ds <- many (lexeme digit)
--                    ; eof
--                    ; return (sum ds)
--                    }
--   
lexeme :: MonadTokenParser m => m a -> m a -- | This lexeme parser parses a single literal character. Returns the -- literal character value. This parsers deals correctly with escape -- sequences. The literal character is parsed according to the grammar -- rules defined in the Haskell report (which matches most programming -- languages quite closely). charLiteral :: MonadTokenParser m => m Char -- | This lexeme parser parses a literal string. Returns the literal string -- value. This parsers deals correctly with escape sequences and gaps. -- The literal string is parsed according to the grammar rules defined in -- the Haskell report (which matches most programming languages quite -- closely). stringLiteral :: MonadTokenParser m => m String -- | This lexeme parser parses a natural number (a positive whole number). -- Returns the value of the number. The number can be specified in -- decimal, hexadecimal or octal. The number is -- parsed according to the grammar rules in the Haskell report. natural :: MonadTokenParser m => m Integer -- | This lexeme parser parses an integer (a whole number). This parser is -- like natural except that it can be prefixed with sign (i.e. '-' -- or '+'). Returns the value of the number. The number can be specified -- in decimal, hexadecimal or octal. The number is -- parsed according to the grammar rules in the Haskell report. integer :: MonadTokenParser m => m Integer -- | This lexeme parser parses a floating point value. Returns the value of -- the number. The number is parsed according to the grammar rules -- defined in the Haskell report. double :: MonadTokenParser m => m Double -- | This lexeme parser parses either natural or a float. -- Returns the value of the number. This parsers deals with any overlap -- in the grammar rules for naturals and floats. The number is parsed -- according to the grammar rules defined in the Haskell report. naturalOrDouble :: MonadTokenParser m => m (Either Integer Double) -- | Lexeme parser symbol s parses string s and -- skips trailing white space. symbol :: MonadTokenParser m => ByteString -> m ByteString -- | Lexeme parser symbolic s parses char s and -- skips trailing white space. symbolic :: MonadTokenParser m => Char -> m Char -- | Lexeme parser parens p parses p enclosed in -- parenthesis, returning the value of p. parens :: MonadTokenParser m => m a -> m a -- | Lexeme parser braces p parses p enclosed in braces -- ('{' and '}'), returning the value of p. braces :: MonadTokenParser m => m a -> m a -- | Lexeme parser angles p parses p enclosed in angle -- brackets ('<' and '>'), returning the value of p. angles :: MonadTokenParser m => m a -> m a -- | Lexeme parser brackets p parses p enclosed in -- brackets ('[' and ']'), returning the value of p. brackets :: MonadTokenParser m => m a -> m a -- | Lexeme parser comma parses the character ',' and skips any -- trailing white space. Returns the string ",". comma :: MonadTokenParser m => m Char -- | Lexeme parser colon parses the character ':' and skips any -- trailing white space. Returns the string ":". colon :: MonadTokenParser m => m Char -- | Lexeme parser dot parses the character '.' and skips any -- trailing white space. Returns the string ".". dot :: MonadTokenParser m => m Char -- | Lexeme parser semiSep p parses zero or more -- occurrences of p separated by semi. Returns a list of -- values returned by p. semiSep :: MonadTokenParser m => m a -> m [a] -- | Lexeme parser semiSep1 p parses one or more -- occurrences of p separated by semi. Returns a list of -- values returned by p. semiSep1 :: MonadTokenParser m => m a -> m [a] -- | Lexeme parser commaSep p parses zero or more -- occurrences of p separated by comma. Returns a list of -- values returned by p. commaSep :: MonadTokenParser m => m a -> m [a] -- | Lexeme parser commaSep1 p parses one or more -- occurrences of p separated by comma. Returns a list of -- values returned by p. commaSep1 :: MonadTokenParser m => m a -> m [a] -- |
--   idStyle = haskellIdentifierStyle { styleReserved = ... }
--   identifier = ident haskellIdentifierStyle
--   reserved   = reserve haskellIdentifierStyle
--   
module Text.Trifecta.Parser.Token.Identifier data IdentifierStyle m IdentifierStyle :: String -> m () -> m () -> HashSet ByteString -> Highlight -> Highlight -> IdentifierStyle m styleName :: IdentifierStyle m -> String styleStart :: IdentifierStyle m -> m () styleLetter :: IdentifierStyle m -> m () styleReserved :: IdentifierStyle m -> HashSet ByteString styleHighlight :: IdentifierStyle m -> Highlight styleReservedHighlight :: IdentifierStyle m -> Highlight -- | Lift an identifier style into a monad transformer liftIdentifierStyle :: (MonadTrans t, Monad m) => IdentifierStyle m -> IdentifierStyle (t m) -- | parse an non-reserved identifier or symbol ident :: MonadTokenParser m => IdentifierStyle m -> m ByteString -- | parse a reserved operator or identifier using a given style reserve :: MonadTokenParser m => IdentifierStyle m -> String -> m () -- | parse a reserved operator or identifier using a given style specified -- by bytestring reserveByteString :: MonadTokenParser m => IdentifierStyle m -> ByteString -> m () module Text.Trifecta.Parser.Token -- | Parses a positive whole number in the decimal system. Returns the -- value of the number. decimal :: MonadParser m => m Integer -- | Parses a positive whole number in the hexadecimal system. The number -- should be prefixed with "x" or "X". Returns the value of the number. hexadecimal :: MonadParser m => m Integer -- | Parses a positive whole number in the octal system. The number should -- be prefixed with "o" or "O". Returns the value of the number. octal :: MonadParser m => m Integer module Text.Trifecta.Parser.Language.Def data LanguageDef m LanguageDef :: CommentStyle -> IdentifierStyle m -> IdentifierStyle m -> LanguageDef m languageCommentStyle :: LanguageDef m -> CommentStyle languageIdentifiers :: LanguageDef m -> IdentifierStyle m languageOperators :: LanguageDef m -> IdentifierStyle m liftLanguageDef :: (MonadTrans t, Monad m) => LanguageDef m -> LanguageDef (t m) module Text.Trifecta.Parser.Language.Class class MonadTokenParser m => MonadLanguage m askLanguage :: MonadLanguage m => m (LanguageDef m) asksLanguage :: MonadLanguage m => (LanguageDef m -> r) -> m r instance (Monoid w, MonadLanguage m) => MonadLanguage (RWST r w s m) instance (Monoid w, MonadLanguage m) => MonadLanguage (RWST r w s m) instance MonadLanguage m => MonadLanguage (IdentityT m) instance MonadLanguage m => MonadLanguage (ReaderT s m) instance (Monoid w, MonadLanguage m) => MonadLanguage (WriterT w m) instance (Monoid w, MonadLanguage m) => MonadLanguage (WriterT w m) instance MonadLanguage m => MonadLanguage (StateT s m) instance MonadLanguage m => MonadLanguage (StateT s m) module Text.Trifecta.Parser.Language.Combinators identifier :: MonadLanguage m => m ByteString reserved :: MonadLanguage m => String -> m () reservedByteString :: MonadLanguage m => ByteString -> m () op :: MonadLanguage m => m ByteString reservedOp :: MonadLanguage m => String -> m () reservedOpByteString :: MonadLanguage m => ByteString -> m () module Text.Trifecta.Parser.Language.Monad newtype Language m a Language :: ReaderT (LanguageDef (Language m)) m a -> Language m a unlanguage :: Language m a -> ReaderT (LanguageDef (Language m)) m a runLanguage :: Language m a -> LanguageDef (Language m) -> m a instance Functor m => Functor (Language m) instance Applicative m => Applicative (Language m) instance Alternative m => Alternative (Language m) instance Monad m => Monad (Language m) instance MonadPlus m => MonadPlus (Language m) instance MonadParser m => MonadParser (Language m) instance MonadCont m => MonadCont (Language m) instance MonadReader e m => MonadReader e (Language m) instance MonadWriter w m => MonadWriter w (Language m) instance MonadState s m => MonadState s (Language m) instance MonadDiagnostic e m => MonadDiagnostic e (Language m) instance MonadParser m => MonadTokenParser (Language m) instance MonadTrans Language instance MonadParser m => MonadLanguage (Language m) module Text.Trifecta.Parser.Token.Identifier.Style emptyIdents, haskellIdents, haskell98Idents :: MonadTokenParser m => IdentifierStyle m emptyOps, haskellOps, haskell98Ops :: MonadTokenParser m => IdentifierStyle m module Text.Trifecta.Parser.Language.Style emptyLanguageDef, haskell98LanguageDef, haskellLanguageDef :: MonadTokenParser m => LanguageDef m module Text.Trifecta.Parser.Language newtype Language m a Language :: ReaderT (LanguageDef (Language m)) m a -> Language m a unlanguage :: Language m a -> ReaderT (LanguageDef (Language m)) m a runLanguage :: Language m a -> LanguageDef (Language m) -> m a data LanguageDef m LanguageDef :: CommentStyle -> IdentifierStyle m -> IdentifierStyle m -> LanguageDef m languageCommentStyle :: LanguageDef m -> CommentStyle languageIdentifiers :: LanguageDef m -> IdentifierStyle m languageOperators :: LanguageDef m -> IdentifierStyle m class MonadTokenParser m => MonadLanguage m askLanguage :: MonadLanguage m => m (LanguageDef m) asksLanguage :: MonadLanguage m => (LanguageDef m -> r) -> m r identifier :: MonadLanguage m => m ByteString reserved :: MonadLanguage m => String -> m () reservedByteString :: MonadLanguage m => ByteString -> m () op :: MonadLanguage m => m ByteString reservedOp :: MonadLanguage m => String -> m () reservedOpByteString :: MonadLanguage m => ByteString -> m () emptyLanguageDef, haskell98LanguageDef, haskellLanguageDef :: MonadTokenParser m => LanguageDef m module Text.Trifecta.Parser.Layout.Combinators layoutEq :: MonadLayoutParser m => LayoutToken -> m LayoutToken disableLayout :: MonadLayoutParser m => m a -> m a enableLayout :: MonadLayoutParser m => m a -> m a laidout :: MonadLayoutParser m => m a -> m a module Text.Trifecta.Parser.Layout.Monad newtype Layout m a Layout :: StateT LayoutState m a -> Layout m a unlayout :: Layout m a -> StateT LayoutState m a runLayout :: Monad m => Layout m a -> LayoutState -> m (a, LayoutState) instance Functor m => Functor (Layout m) instance (Monad m, Functor m) => Applicative (Layout m) instance (Functor m, MonadPlus m) => Alternative (Layout m) instance Monad m => Monad (Layout m) instance MonadPlus m => MonadPlus (Layout m) instance MonadTrans Layout instance MonadCont m => MonadCont (Layout m) instance MonadWriter w m => MonadWriter w (Layout m) instance MonadReader e m => MonadReader e (Layout m) instance MonadState s m => MonadState s (Layout m) instance MonadTokenParser m => MonadLayoutParser (Layout m) instance MonadTokenParser m => MonadTokenParser (Layout m) instance MonadDiagnostic e m => MonadDiagnostic e (Layout m) instance MonadTokenParser m => MonadParser (Layout m) module Text.Trifecta.Parser.Layout newtype Layout m a Layout :: StateT LayoutState m a -> Layout m a unlayout :: Layout m a -> StateT LayoutState m a class MonadTokenParser m => MonadLayoutParser m layout :: MonadLayoutParser m => m LayoutToken getLayout :: MonadLayoutParser m => Lens LayoutState t -> m t setLayout :: MonadLayoutParser m => Lens LayoutState t -> t -> m () modLayout :: MonadLayoutParser m => Lens LayoutState t -> (t -> t) -> m () runLayout :: Monad m => Layout m a -> LayoutState -> m (a, LayoutState) defaultLayoutState :: LayoutState module Text.Trifecta.Parser.Haskell type Haskell m = Layout (Language m) haskell :: MonadParser m => Haskell m a -> m a haskell98 :: MonadParser m => Haskell m a -> m a -- | This provides a thin backwards compatibility layer for folks who want -- to write parsers for languages where characters are bytes and don't -- need to deal with unicode issues. Diagnostics will still report the -- correct column number in the absence of high ascii characters but if -- you have those in your source file, you probably aren't going to want -- to draw those to the screen anyways. module Text.Trifecta.Parser.Char8 -- | Using this instead of Text.Trifecta.Parser.Class.satisfy you -- too can time travel back to when men were men and characters fit into -- 8 bits like God intended. It might also be useful when writing lots of -- fiddly protocol code, where the UTF8 decoding is probably a very bad -- idea. satisfy :: MonadParser m => (Char -> Bool) -> m Char -- | oneOf cs succeeds if the current character is in the supplied -- list of characters cs. Returns the parsed character. See also -- satisfy. -- --
--   vowel  = oneOf "aeiou"
--   
oneOf :: MonadParser m => [Char] -> m Char -- | As the dual of oneOf, noneOf cs succeeds if the -- current character not in the supplied list of characters -- cs. Returns the parsed character. -- --
--   consonant = noneOf "aeiou"
--   
noneOf :: MonadParser m => [Char] -> m Char -- | oneOfSet cs succeeds if the current character is in the -- supplied set of characters cs. Returns the parsed character. -- See also satisfy. -- --
--   vowel  = oneOf "aeiou"
--   
oneOfSet :: MonadParser m => ByteSet -> m Char -- | As the dual of oneOf, noneOf cs succeeds if the -- current character not in the supplied list of characters -- cs. Returns the parsed character. -- --
--   consonant = noneOf "aeiou"
--   
noneOfSet :: MonadParser m => ByteSet -> m Char -- | Skips zero or more white space characters. See also -- skipMany and whiteSpace. spaces :: MonadParser m => m () -- | Parses a white space character (any character which satisfies -- isSpace) Returns the parsed character. space :: MonadParser m => m Char -- | Parses a newline character ('\n'). Returns a newline character. newline :: MonadParser m => m Char -- | Parses a tab character ('\t'). Returns a tab character. tab :: MonadParser m => m Char -- | Parses an upper case letter (a character between 'A' and 'Z'). Returns -- the parsed character. upper :: MonadParser m => m Char -- | Parses a lower case character (a character between 'a' and 'z'). -- Returns the parsed character. lower :: MonadParser m => m Char -- | Parses a letter or digit (a character between '0' and '9'). Returns -- the parsed character. alphaNum :: MonadParser m => m Char -- | Parses a letter (an upper case or lower case character). Returns the -- parsed character. letter :: MonadParser m => m Char -- | Parses a digit. Returns the parsed character. digit :: MonadParser m => m Char -- | Parses a hexadecimal digit (a digit or a letter between 'a' and 'f' or -- 'A' and 'F'). Returns the parsed character. hexDigit :: MonadParser m => m Char -- | Parses an octal digit (a character between '0' and '7'). Returns the -- parsed character. octDigit :: MonadParser m => m Char -- | char c parses a single character c. Returns the -- parsed character (i.e. c). -- --
--   semiColon  = char ';'
--   
char :: MonadParser m => Char -> m Char -- | char c parses a single character c. Returns the -- parsed character (i.e. c). -- --
--   semiColon  = char ';'
--   
notChar :: MonadParser m => Char -> m Char -- | This parser succeeds for any character. Returns the parsed character. anyChar :: MonadParser m => m Char -- | string s parses a sequence of characters given by s. -- Returns the parsed string (i.e. s). -- --
--   divOrMod    =   string "div" 
--               <|> string "mod"
--   
string :: MonadParser m => String -> m String -- | byteString s parses a sequence of bytes given by s. -- Returns the parsed byteString (i.e. s). -- --
--   divOrMod    =   string "div" 
--               <|> string "mod"
--   
byteString :: MonadParser m => ByteString -> m ByteString module Text.Trifecta.Highlight class Highlightable a addHighlights :: Highlightable a => Highlights -> a -> a data Highlight type Highlights = IntervalMap Delta Highlight module Text.Trifecta.Rope data Rope rope :: FingerTree Delta Strand -> Rope strands :: Rope -> FingerTree Delta Strand data Strand Strand :: {-# UNPACK #-} !ByteString -> !Delta -> Strand LineDirective :: {-# UNPACK #-} !ByteString -> {-# UNPACK #-} !Int64 -> Strand strand :: ByteString -> Strand 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 data HighlightedRope HighlightedRope :: !Highlights -> {-# UNPACK #-} !Rope -> HighlightedRope ropeHighlights :: HighlightedRope -> !Highlights ropeContent :: HighlightedRope -> {-# UNPACK #-} !Rope module Text.Trifecta.Parser caret :: MonadParser m => m Caret careted :: MonadParser m => m a -> m (Careted a) span :: MonadParser m => m a -> m Span spanned :: MonadParser m => m a -> m (Spanned a) fixit :: MonadParser m => m ByteString -> m Fixit module Text.Trifecta.Diagnostic data Diagnostic m Diagnostic :: !Either String Rendering -> !DiagnosticLevel -> m -> [Diagnostic m] -> Diagnostic m tellDiagnostic :: (MonadWriter t m, Reducer (Diagnostic e) t) => Diagnostic e -> m () class Renderable t render :: Renderable t => t -> Rendering class Source t -- | create a drawing surface rendering :: Source s => Delta -> s -> Rendering -- |
--   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; }
--                                      ^
--   
data Caret Caret :: !Delta -> {-# UNPACK #-} !ByteString -> Caret data Careted a (:^) :: a -> Caret -> Careted a data Span Span :: !Delta -> !Delta -> {-# UNPACK #-} !ByteString -> Span data Spanned a (:~) :: a -> Span -> Spanned a data Fixit Fixit :: {-# UNPACK #-} !Span -> {-# UNPACK #-} !ByteString -> Fixit fixitSpan :: Fixit -> {-# UNPACK #-} !Span fixitReplacement :: Fixit -> {-# UNPACK #-} !ByteString data Rendered a (:@) :: a -> Rendering -> Rendered a class Monad m => MonadDiagnostic e m | m -> e fatalWith :: MonadDiagnostic e m => [Diagnostic e] -> [Rendering] -> e -> m a errWith :: MonadDiagnostic e m => [Diagnostic e] -> [Rendering] -> e -> m a logWith :: MonadDiagnostic e m => DiagnosticLevel -> [Diagnostic e] -> [Rendering] -> e -> m () fatal :: MonadDiagnostic e m => e -> m a err :: MonadDiagnostic e m => e -> m a warn :: MonadDiagnostic e m => e -> m () note :: MonadDiagnostic e m => e -> m () verbose :: MonadDiagnostic e m => Int -> e -> m () warnWith :: MonadDiagnostic e m => [Diagnostic e] -> [Rendering] -> e -> m () noteWith :: MonadDiagnostic e m => [Diagnostic e] -> [Rendering] -> e -> m () verboseWith :: MonadDiagnostic e m => Int -> [Diagnostic e] -> [Rendering] -> e -> m () -- | The severity of an error (or message) data DiagnosticLevel -- | a comment we should only show to the excessively curious Verbose :: !Int -> DiagnosticLevel -- | a comment Note :: DiagnosticLevel -- | a warning, computation continues Warning :: DiagnosticLevel -- | a user specified error Error :: DiagnosticLevel -- | a user specified fatal error Fatal :: DiagnosticLevel -- | a non-maskable death sentence thrown by the parser itself Panic :: DiagnosticLevel module Text.Trifecta