trifecta-2: A modern parser combinator library with convenient diagnostics

Copyright(C) 2011-2015 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Text.Trifecta.Rendering

Contents

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
Show Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Semigroup Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Monoid Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Pretty Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

HasDelta Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

HasRendering 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 Caret Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Reducer (Spanned a) Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Reducer (Careted 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 (pretty emptyRendering)
""

class Source t where Source #

Minimal complete definition

source

Methods

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

( Number of (padded) columns
, number of bytes
, line )
Instances
Source String Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

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

Source ByteString Source # 
Instance details

Defined in Text.Trifecta.Rendering

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

create a drawing surface

class Renderable t where Source #

Minimal complete definition

render

Methods

render :: t -> Rendering Source #

Instances
Renderable Rendering Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable (Spanned a) 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

data Rendered a Source #

Constructors

a :@ Rendering 
Instances
Functor Rendered Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

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

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

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 #

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) #

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 #

HasDelta (Rendered a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

delta :: Rendered a -> Delta Source #

HasBytes (Rendered a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

bytes :: Rendered a -> Int64 Source #

Renderable (Rendered a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Carets

data Caret Source #

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

>>> plain (pretty (addCaret (Columns 35 35) exampleRendering))
int main(int argc, char ** argv) { int; }<EOF>
                                   ^

Constructors

Caret !Delta !ByteString 
Instances
Eq Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

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

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

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 :: (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 #

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 #

Show Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

showsPrec :: Int -> Caret -> ShowS #

show :: Caret -> String #

showList :: [Caret] -> ShowS #

Generic Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Associated Types

type Rep Caret :: * -> * #

Methods

from :: Caret -> Rep Caret x #

to :: Rep Caret x -> 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 #

Hashable Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

hashWithSalt :: Int -> Caret -> Int #

hash :: Caret -> Int #

HasDelta Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

delta :: Caret -> Delta Source #

HasBytes Caret Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

bytes :: Caret -> Int64 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-3LqJ6YGQno0FNVjGdpeVXY" 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 #

Minimal complete definition

caret

Methods

caret :: Lens' t Caret Source #

Instances
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
Functor Careted Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

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

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

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 #

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) #

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 #

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

Defined in Text.Trifecta.Rendering

Methods

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

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

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 :: (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) #

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 #

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 #

Generic (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Associated Types

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

Methods

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

to :: Rep (Careted a) x -> 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 #

HasDelta (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

delta :: Careted a -> Delta Source #

HasBytes (Careted a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

bytes :: Careted a -> Int64 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

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.

>>> plain (pretty (addSpan (Columns 35 35) (Columns 38 38) exampleRendering))
int main(int argc, char ** argv) { int; }<EOF>
                                   ~~~

Constructors

Span !Delta !Delta !ByteString 
Instances
Eq Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

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

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

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 :: (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 #

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 #

Show Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

showsPrec :: Int -> Span -> ShowS #

show :: Span -> String #

showList :: [Span] -> ShowS #

Generic Span Source # 
Instance details

Defined in Text.Trifecta.Rendering

Associated Types

type Rep Span :: * -> * #

Methods

from :: Span -> Rep Span x #

to :: Rep Span x -> 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 #

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 #

Minimal complete definition

span

Methods

span :: Lens' t Span Source #

Instances
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
Functor Spanned Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

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

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

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 #

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) #

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 #

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

Defined in Text.Trifecta.Rendering

Methods

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

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

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 :: (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) #

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 #

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 #

Generic (Spanned a) Source # 
Instance details

Defined in Text.Trifecta.Rendering

Associated Types

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

Methods

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

to :: Rep (Spanned a) x -> 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

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.

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

Constructors

Fixit 

Fields

Instances
Eq Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

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

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

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 :: (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 #

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 #

Show Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

showsPrec :: Int -> Fixit -> ShowS #

show :: Fixit -> String #

showList :: [Fixit] -> ShowS #

Generic Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Associated Types

type Rep Fixit :: * -> * #

Methods

from :: Fixit -> Rep Fixit x #

to :: Rep Fixit x -> Fixit #

Hashable Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Methods

hashWithSalt :: Int -> Fixit -> Int #

hash :: Fixit -> Int #

HasSpan Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

Renderable Fixit Source # 
Instance details

Defined in Text.Trifecta.Rendering

HasFixit 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-3LqJ6YGQno0FNVjGdpeVXY" False) (C1 (MetaCons "Fixit" PrefixI True) (S1 (MetaSel (Just "_fixitSpan") SourceUnpack SourceStrict DecidedStrict) (Rec0 Span) :*: S1 (MetaSel (Just "_fixitReplacement") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ByteString)))

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