trifecta-2.1.4: A modern parser combinator library with convenient diagnostics
Copyright(C) 2011-2019 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.Trifecta.Rendering

Description

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.

Synopsis

Documentation

data Rendering Source #

A Rendering is a canvas of text that output can be written to.

Constructors

Rendering !Delta !Int64 !Int64 (Lines -> Lines) (Delta -> Lines -> Lines) 

Instances

Instances details
Monoid Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Semigroup Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Show Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

HasDelta Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

HasRendering Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Reducer Caret Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Reducer Fixit Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Reducer Span Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Reducer (Careted a) Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Reducer (Spanned a) Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

nullRendering :: Rendering -> Bool Source #

Is the Rendering empty?

>>> nullRendering emptyRendering
True
>>> nullRendering exampleRendering
False

emptyRendering :: Rendering Source #

The empty Rendering, which contains nothing at all.

>>> show (prettyRendering emptyRendering)
""

class Source t where Source #

Methods

source :: t -> (Int64, Int64, Lines -> Lines) Source #

( Number of (padded) columns
, number of bytes
, line )

Instances

Instances details
Source ByteString Source # 
Instance details

Defined in Text.Trifecta.Rendering

Source String Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

source :: String -> (Int64, Int64, Lines -> Lines) Source #

rendered :: Source s => Delta -> s -> Rendering Source #

create a drawing surface

class Renderable t where Source #

Methods

render :: t -> Rendering Source #

Instances

Instances details
Renderable Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable (Rendered a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable (Spanned a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

data Rendered a Source #

Constructors

a :@ Rendering 

Instances

Instances details
Foldable Rendered Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

fold :: Monoid m => Rendered m -> m #

foldMap :: Monoid m => (a -> m) -> Rendered a -> m #

foldMap' :: Monoid m => (a -> m) -> Rendered a -> m #

foldr :: (a -> b -> b) -> b -> Rendered a -> b #

foldr' :: (a -> b -> b) -> b -> Rendered a -> b #

foldl :: (b -> a -> b) -> b -> Rendered a -> b #

foldl' :: (b -> a -> b) -> b -> Rendered a -> b #

foldr1 :: (a -> a -> a) -> Rendered a -> a #

foldl1 :: (a -> a -> a) -> Rendered a -> a #

toList :: Rendered a -> [a] #

null :: Rendered a -> Bool #

length :: Rendered a -> Int #

elem :: Eq a => a -> Rendered a -> Bool #

maximum :: Ord a => Rendered a -> a #

minimum :: Ord a => Rendered a -> a #

sum :: Num a => Rendered a -> a #

product :: Num a => Rendered a -> a #

Traversable Rendered Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

traverse :: Applicative f => (a -> f b) -> Rendered a -> f (Rendered b) #

sequenceA :: Applicative f => Rendered (f a) -> f (Rendered a) #

mapM :: Monad m => (a -> m b) -> Rendered a -> m (Rendered b) #

sequence :: Monad m => Rendered (m a) -> m (Rendered a) #

Functor Rendered Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

fmap :: (a -> b) -> Rendered a -> Rendered b #

(<$) :: a -> Rendered b -> Rendered a #

Comonad Rendered Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

extract :: Rendered a -> a #

duplicate :: Rendered a -> Rendered (Rendered a) #

extend :: (Rendered a -> b) -> Rendered a -> Rendered b #

ComonadApply Rendered Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

(<@>) :: Rendered (a -> b) -> Rendered a -> Rendered b #

(@>) :: Rendered a -> Rendered b -> Rendered b #

(<@) :: Rendered a -> Rendered b -> Rendered a #

Show a => Show (Rendered a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

showsPrec :: Int -> Rendered a -> ShowS #

show :: Rendered a -> String #

showList :: [Rendered a] -> ShowS #

HasBytes (Rendered a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

bytes :: Rendered a -> Int64 Source #

HasDelta (Rendered a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

delta :: Rendered a -> Delta Source #

Renderable (Rendered a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

gutterEffects :: [SGR] Source #

ANSI terminal style for rendering the gutter.

Carets

data Caret Source #

A Caret marks a point in the input with a simple ^ character.

>>> unAnnotate (prettyRendering (addCaret (Columns 35 35) exampleRendering))
1 | int main(int argc, char ** argv) { int; }<EOF>
  |                                    ^

Constructors

Caret !Delta !ByteString 

Instances

Instances details
Data Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Caret -> c Caret #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Caret #

toConstr :: Caret -> Constr #

dataTypeOf :: Caret -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Caret) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Caret) #

gmapT :: (forall b. Data b => b -> b) -> Caret -> Caret #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Caret -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Caret -> r #

gmapQ :: (forall d. Data d => d -> u) -> Caret -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Caret -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Caret -> m Caret #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Caret -> m Caret #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Caret -> m Caret #

Semigroup Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

(<>) :: Caret -> Caret -> Caret #

sconcat :: NonEmpty Caret -> Caret #

stimes :: Integral b => b -> Caret -> Caret #

Generic Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Associated Types

type Rep Caret :: Type -> Type #

Methods

from :: Caret -> Rep Caret x #

to :: Rep Caret x -> Caret #

Show Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

showsPrec :: Int -> Caret -> ShowS #

show :: Caret -> String #

showList :: [Caret] -> ShowS #

Eq Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

(==) :: Caret -> Caret -> Bool #

(/=) :: Caret -> Caret -> Bool #

Ord Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

compare :: Caret -> Caret -> Ordering #

(<) :: Caret -> Caret -> Bool #

(<=) :: Caret -> Caret -> Bool #

(>) :: Caret -> Caret -> Bool #

(>=) :: Caret -> Caret -> Bool #

max :: Caret -> Caret -> Caret #

min :: Caret -> Caret -> Caret #

Hashable Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

hashWithSalt :: Int -> Caret -> Int #

hash :: Caret -> Int #

HasBytes Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

bytes :: Caret -> Int64 Source #

HasDelta Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

delta :: Caret -> Delta Source #

HasCaret Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Reducer Caret Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

type Rep Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

type Rep Caret = D1 ('MetaData "Caret" "Text.Trifecta.Rendering" "trifecta-2.1.4-AtxOMZK0MUEHOtLDlbMlQl" 'False) (C1 ('MetaCons "Caret" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Delta) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 ByteString)))

class HasCaret t where Source #

Methods

caret :: Lens' t Caret Source #

Instances

Instances details
HasCaret Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

HasCaret (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

data Careted a Source #

Constructors

a :^ Caret 

Instances

Instances details
Foldable Careted Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

fold :: Monoid m => Careted m -> m #

foldMap :: Monoid m => (a -> m) -> Careted a -> m #

foldMap' :: Monoid m => (a -> m) -> Careted a -> m #

foldr :: (a -> b -> b) -> b -> Careted a -> b #

foldr' :: (a -> b -> b) -> b -> Careted a -> b #

foldl :: (b -> a -> b) -> b -> Careted a -> b #

foldl' :: (b -> a -> b) -> b -> Careted a -> b #

foldr1 :: (a -> a -> a) -> Careted a -> a #

foldl1 :: (a -> a -> a) -> Careted a -> a #

toList :: Careted a -> [a] #

null :: Careted a -> Bool #

length :: Careted a -> Int #

elem :: Eq a => a -> Careted a -> Bool #

maximum :: Ord a => Careted a -> a #

minimum :: Ord a => Careted a -> a #

sum :: Num a => Careted a -> a #

product :: Num a => Careted a -> a #

Traversable Careted Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

traverse :: Applicative f => (a -> f b) -> Careted a -> f (Careted b) #

sequenceA :: Applicative f => Careted (f a) -> f (Careted a) #

mapM :: Monad m => (a -> m b) -> Careted a -> m (Careted b) #

sequence :: Monad m => Careted (m a) -> m (Careted a) #

Functor Careted Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

fmap :: (a -> b) -> Careted a -> Careted b #

(<$) :: a -> Careted b -> Careted a #

Comonad Careted Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

extract :: Careted a -> a #

duplicate :: Careted a -> Careted (Careted a) #

extend :: (Careted a -> b) -> Careted a -> Careted b #

ComonadApply Careted Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

(<@>) :: Careted (a -> b) -> Careted a -> Careted b #

(@>) :: Careted a -> Careted b -> Careted b #

(<@) :: Careted a -> Careted b -> Careted a #

Data a => Data (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Careted a -> c (Careted a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Careted a) #

toConstr :: Careted a -> Constr #

dataTypeOf :: Careted a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Careted a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Careted a)) #

gmapT :: (forall b. Data b => b -> b) -> Careted a -> Careted a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Careted a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Careted a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Careted a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Careted a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Careted a -> m (Careted a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Careted a -> m (Careted a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Careted a -> m (Careted a) #

Generic (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Associated Types

type Rep (Careted a) :: Type -> Type #

Methods

from :: Careted a -> Rep (Careted a) x #

to :: Rep (Careted a) x -> Careted a #

Show a => Show (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

showsPrec :: Int -> Careted a -> ShowS #

show :: Careted a -> String #

showList :: [Careted a] -> ShowS #

Eq a => Eq (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

(==) :: Careted a -> Careted a -> Bool #

(/=) :: Careted a -> Careted a -> Bool #

Ord a => Ord (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

compare :: Careted a -> Careted a -> Ordering #

(<) :: Careted a -> Careted a -> Bool #

(<=) :: Careted a -> Careted a -> Bool #

(>) :: Careted a -> Careted a -> Bool #

(>=) :: Careted a -> Careted a -> Bool #

max :: Careted a -> Careted a -> Careted a #

min :: Careted a -> Careted a -> Careted a #

Hashable a => Hashable (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

hashWithSalt :: Int -> Careted a -> Int #

hash :: Careted a -> Int #

HasBytes (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

bytes :: Careted a -> Int64 Source #

HasDelta (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

delta :: Careted a -> Delta Source #

HasCaret (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Reducer (Careted a) Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

type Rep (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

type Rep (Careted a) = D1 ('MetaData "Careted" "Text.Trifecta.Rendering" "trifecta-2.1.4-AtxOMZK0MUEHOtLDlbMlQl" 'False) (C1 ('MetaCons ":^" ('InfixI 'LeftAssociative 9) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Caret)))

addCaret :: Delta -> Rendering -> Rendering Source #

Render a caret at a certain position in a Rendering.

caretEffects :: [SGR] Source #

ANSI terminal style for rendering the caret.

Spans

data Span Source #

A Span marks a range of input characters. If Caret is a point, then Span is a line.

>>> unAnnotate (prettyRendering (addSpan (Columns 35 35) (Columns 38 38) exampleRendering))
1 | int main(int argc, char ** argv) { int; }<EOF>
  |                                    ~~~

Constructors

Span !Delta !Delta !ByteString 

Instances

Instances details
Data Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Span -> c Span #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Span #

toConstr :: Span -> Constr #

dataTypeOf :: Span -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Span) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Span) #

gmapT :: (forall b. Data b => b -> b) -> Span -> Span #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Span -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Span -> r #

gmapQ :: (forall d. Data d => d -> u) -> Span -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Span -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Span -> m Span #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Span -> m Span #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Span -> m Span #

Semigroup Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

(<>) :: Span -> Span -> Span #

sconcat :: NonEmpty Span -> Span #

stimes :: Integral b => b -> Span -> Span #

Generic Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Associated Types

type Rep Span :: Type -> Type #

Methods

from :: Span -> Rep Span x #

to :: Rep Span x -> Span #

Show Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

showsPrec :: Int -> Span -> ShowS #

show :: Span -> String #

showList :: [Span] -> ShowS #

Eq Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

(==) :: Span -> Span -> Bool #

(/=) :: Span -> Span -> Bool #

Ord Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

compare :: Span -> Span -> Ordering #

(<) :: Span -> Span -> Bool #

(<=) :: Span -> Span -> Bool #

(>) :: Span -> Span -> Bool #

(>=) :: Span -> Span -> Bool #

max :: Span -> Span -> Span #

min :: Span -> Span -> Span #

Hashable Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

hashWithSalt :: Int -> Span -> Int #

hash :: Span -> Int #

HasSpan Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Reducer Span Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

type Rep Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

class HasSpan t where Source #

Methods

span :: Lens' t Span Source #

Instances

Instances details
HasSpan Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

HasSpan Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

HasSpan (Spanned a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

span :: Lens' (Spanned a) Span Source #

data Spanned a Source #

Annotate an arbitrary piece of data with a Span, typically its corresponding input location.

Constructors

a :~ Span 

Instances

Instances details
Foldable Spanned Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

fold :: Monoid m => Spanned m -> m #

foldMap :: Monoid m => (a -> m) -> Spanned a -> m #

foldMap' :: Monoid m => (a -> m) -> Spanned a -> m #

foldr :: (a -> b -> b) -> b -> Spanned a -> b #

foldr' :: (a -> b -> b) -> b -> Spanned a -> b #

foldl :: (b -> a -> b) -> b -> Spanned a -> b #

foldl' :: (b -> a -> b) -> b -> Spanned a -> b #

foldr1 :: (a -> a -> a) -> Spanned a -> a #

foldl1 :: (a -> a -> a) -> Spanned a -> a #

toList :: Spanned a -> [a] #

null :: Spanned a -> Bool #

length :: Spanned a -> Int #

elem :: Eq a => a -> Spanned a -> Bool #

maximum :: Ord a => Spanned a -> a #

minimum :: Ord a => Spanned a -> a #

sum :: Num a => Spanned a -> a #

product :: Num a => Spanned a -> a #

Traversable Spanned Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

traverse :: Applicative f => (a -> f b) -> Spanned a -> f (Spanned b) #

sequenceA :: Applicative f => Spanned (f a) -> f (Spanned a) #

mapM :: Monad m => (a -> m b) -> Spanned a -> m (Spanned b) #

sequence :: Monad m => Spanned (m a) -> m (Spanned a) #

Functor Spanned Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

fmap :: (a -> b) -> Spanned a -> Spanned b #

(<$) :: a -> Spanned b -> Spanned a #

Comonad Spanned Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

extract :: Spanned a -> a #

duplicate :: Spanned a -> Spanned (Spanned a) #

extend :: (Spanned a -> b) -> Spanned a -> Spanned b #

ComonadApply Spanned Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

(<@>) :: Spanned (a -> b) -> Spanned a -> Spanned b #

(@>) :: Spanned a -> Spanned b -> Spanned b #

(<@) :: Spanned a -> Spanned b -> Spanned a #

Data a => Data (Spanned a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Spanned a -> c (Spanned a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Spanned a) #

toConstr :: Spanned a -> Constr #

dataTypeOf :: Spanned a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Spanned a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Spanned a)) #

gmapT :: (forall b. Data b => b -> b) -> Spanned a -> Spanned a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Spanned a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Spanned a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Spanned a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Spanned a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Spanned a -> m (Spanned a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Spanned a -> m (Spanned a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Spanned a -> m (Spanned a) #

Generic (Spanned a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Associated Types

type Rep (Spanned a) :: Type -> Type #

Methods

from :: Spanned a -> Rep (Spanned a) x #

to :: Rep (Spanned a) x -> Spanned a #

Show a => Show (Spanned a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

showsPrec :: Int -> Spanned a -> ShowS #

show :: Spanned a -> String #

showList :: [Spanned a] -> ShowS #

Eq a => Eq (Spanned a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

(==) :: Spanned a -> Spanned a -> Bool #

(/=) :: Spanned a -> Spanned a -> Bool #

Ord a => Ord (Spanned a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

compare :: Spanned a -> Spanned a -> Ordering #

(<) :: Spanned a -> Spanned a -> Bool #

(<=) :: Spanned a -> Spanned a -> Bool #

(>) :: Spanned a -> Spanned a -> Bool #

(>=) :: Spanned a -> Spanned a -> Bool #

max :: Spanned a -> Spanned a -> Spanned a #

min :: Spanned a -> Spanned a -> Spanned a #

Hashable a => Hashable (Spanned a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

hashWithSalt :: Int -> Spanned a -> Int #

hash :: Spanned a -> Int #

HasSpan (Spanned a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

span :: Lens' (Spanned a) Span Source #

Renderable (Spanned a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Reducer (Spanned a) Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

type Rep (Spanned a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

type Rep (Spanned a) = D1 ('MetaData "Spanned" "Text.Trifecta.Rendering" "trifecta-2.1.4-AtxOMZK0MUEHOtLDlbMlQl" 'False) (C1 ('MetaCons ":~" ('InfixI 'LeftAssociative 9) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Span)))

spanEffects :: [SGR] Source #

ANSI terminal style to render spans with.

drawSpan Source #

Arguments

:: Delta

Start of the region of interest

-> Delta

End of the region of interest

-> Delta

Currrent location

-> Lines

Lines to add the rendering to

-> Lines 

Fixits

data Fixit Source #

A Fixit is a Span with a suggestion.

>>> unAnnotate (prettyRendering (addFixit (Columns 35 35) (Columns 38 38) "Fix this!" exampleRendering))
1 | int main(int argc, char ** argv) { int; }<EOF>
  |                                    ~~~
  |                                    Fix this!

Constructors

Fixit 

Fields

Instances

Instances details
Data Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Fixit -> c Fixit #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Fixit #

toConstr :: Fixit -> Constr #

dataTypeOf :: Fixit -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Fixit) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fixit) #

gmapT :: (forall b. Data b => b -> b) -> Fixit -> Fixit #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fixit -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fixit -> r #

gmapQ :: (forall d. Data d => d -> u) -> Fixit -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Fixit -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Fixit -> m Fixit #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Fixit -> m Fixit #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Fixit -> m Fixit #

Generic Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Associated Types

type Rep Fixit :: Type -> Type #

Methods

from :: Fixit -> Rep Fixit x #

to :: Rep Fixit x -> Fixit #

Show Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

showsPrec :: Int -> Fixit -> ShowS #

show :: Fixit -> String #

showList :: [Fixit] -> ShowS #

Eq Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

(==) :: Fixit -> Fixit -> Bool #

(/=) :: Fixit -> Fixit -> Bool #

Ord Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

compare :: Fixit -> Fixit -> Ordering #

(<) :: Fixit -> Fixit -> Bool #

(<=) :: Fixit -> Fixit -> Bool #

(>) :: Fixit -> Fixit -> Bool #

(>=) :: Fixit -> Fixit -> Bool #

max :: Fixit -> Fixit -> Fixit #

min :: Fixit -> Fixit -> Fixit #

Hashable Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

hashWithSalt :: Int -> Fixit -> Int #

hash :: Fixit -> Int #

HasFixit Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

HasSpan Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Reducer Fixit Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

type Rep Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

type Rep Fixit = D1 ('MetaData "Fixit" "Text.Trifecta.Rendering" "trifecta-2.1.4-AtxOMZK0MUEHOtLDlbMlQl" 'False) (C1 ('MetaCons "Fixit" 'PrefixI 'True) (S1 ('MetaSel ('Just "_fixitSpan") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Span) :*: S1 ('MetaSel ('Just "_fixitReplacement") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString)))

class HasFixit c where Source #

Minimal complete definition

fixit

Drawing primitives

type Lines = Array (Int, Int64) ([SGR], Char) Source #

A raw canvas to paint ANSI-styled characters on.

draw Source #

Arguments

:: [SGR]

ANSI style to use

-> Int

Line; 0 is at the top

-> Int64

Column; 0 is on the left

-> String

Data to be written

-> Lines

Canvas to draw on

-> Lines 

ifNear Source #

Arguments

:: Delta

Position 1

-> (Lines -> Lines)

Modify the fallback result if the positions are near each other

-> Delta

Position 2

-> Lines

Fallback result if the positions are not near each other

-> Lines