Text.Trifecta.Rendering

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

Copyright | (C) 2011-2015 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | experimental
Portability | non-portable
Safe Haskell | None
Language | Haskell2010

Text.Trifecta.Rendering

Contents

- Carets
- Spans
- Fixits
- Drawing primitives

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

- data Rendering = Rendering !Delta !Int64 !Int64 (Lines -> Lines) (Delta -> Lines -> Lines)
- class HasRendering c where
- nullRendering :: Rendering -> Bool
- emptyRendering :: Rendering
- class Source t where
- rendered :: Source s => Delta -> s -> Rendering
- class Renderable t where
- data Rendered a = a :@ Rendering
- data Caret = Caret !Delta !ByteString
- class HasCaret t where
- data Careted a = a :^ Caret
- drawCaret :: Delta -> Delta -> Lines -> Lines
- addCaret :: Delta -> Rendering -> Rendering
- caretEffects :: [SGR]
- renderingCaret :: Delta -> ByteString -> Rendering
- data Span = Span !Delta !Delta !ByteString
- class HasSpan t where
- data Spanned a = a :~ Span
- spanEffects :: [SGR]
- drawSpan :: Delta -> Delta -> Delta -> Lines -> Lines
- addSpan :: Delta -> Delta -> Rendering -> Rendering
- data Fixit = Fixit {
  - _fixitSpan :: !Span
  - _fixitReplacement :: !ByteString
  }
- class HasFixit c where
- drawFixit :: Delta -> Delta -> String -> Delta -> Lines -> Lines
- addFixit :: Delta -> Delta -> String -> Rendering -> Rendering
- type Lines = Array (Int, Int64) ([SGR], Char)
- draw :: [SGR] -> Int -> Int64 -> String -> Lines -> Lines
- ifNear :: Delta -> (Lines -> Lines) -> Delta -> Lines -> Lines
- (.#) :: (Delta -> Lines -> Lines) -> Rendering -> Rendering

# Documentation

data Rendering #

Constructors

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

Instances

Show Rendering # |
Methods showsPrec :: Int -> Rendering -> ShowS # show :: Rendering -> String # showList :: [Rendering] -> ShowS #
Semigroup Rendering # |
Methods (<>) :: Rendering -> Rendering -> Rendering # sconcat :: NonEmpty Rendering -> Rendering # stimes :: Integral b => b -> Rendering -> Rendering #
Monoid Rendering # |
Methods mempty :: Rendering # mappend :: Rendering -> Rendering -> Rendering # mconcat :: [Rendering] -> Rendering #
Pretty Rendering # |
Methods pretty :: Rendering -> Doc # prettyList :: [Rendering] -> Doc #
HasDelta Rendering # |
Methods delta :: Rendering -> Delta #
Renderable Rendering # |
Methods render :: Rendering -> Rendering #
HasRendering Rendering # |
Methods rendering :: Lens' Rendering Rendering # renderingDelta :: Lens' Rendering Delta # renderingLine :: Lens' Rendering (Lines -> Lines) # renderingLineBytes :: Lens' Rendering Int64 # renderingLineLen :: Lens' Rendering Int64 # renderingOverlays :: Lens' Rendering (Delta -> Lines -> Lines) #
Reducer Fixit Rendering # |
Methods unit :: Fixit -> Rendering # snoc :: Rendering -> Fixit -> Rendering # cons :: Fixit -> Rendering -> Rendering #
Reducer Span Rendering # |
Methods unit :: Span -> Rendering # snoc :: Rendering -> Span -> Rendering # cons :: Span -> Rendering -> Rendering #
Reducer Caret Rendering # |
Methods unit :: Caret -> Rendering # snoc :: Rendering -> Caret -> Rendering # cons :: Caret -> Rendering -> Rendering #
Reducer (Spanned a) Rendering # |
Methods unit :: Spanned a -> Rendering # snoc :: Rendering -> Spanned a -> Rendering # cons :: Spanned a -> Rendering -> Rendering #
Reducer (Careted a) Rendering # |
Methods unit :: Careted a -> Rendering # snoc :: Rendering -> Careted a -> Rendering # cons :: Careted a -> Rendering -> Rendering #

class HasRendering c where #

Minimal complete definition

rendering

Methods

rendering :: Lens' c Rendering #

renderingDelta :: Lens' c Delta #

renderingLine :: Lens' c (Lines -> Lines) #

renderingLineBytes :: Lens' c Int64 #

renderingLineLen :: Lens' c Int64 #

renderingOverlays :: Lens' c (Delta -> Lines -> Lines) #

Instances

HasRendering Rendering # |
Methods rendering :: Lens' Rendering Rendering # renderingDelta :: Lens' Rendering Delta # renderingLine :: Lens' Rendering (Lines -> Lines) # renderingLineBytes :: Lens' Rendering Int64 # renderingLineLen :: Lens' Rendering Int64 # renderingOverlays :: Lens' Rendering (Delta -> Lines -> Lines) #

nullRendering :: Rendering -> Bool #

emptyRendering :: Rendering #

class Source t where #

Minimal complete definition

source

Methods

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

Instances

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

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

create a drawing surface

class Renderable t where #

Minimal complete definition

render

Methods

render :: t -> Rendering #

Instances

Renderable Rendering # |
Methods render :: Rendering -> Rendering #
Renderable Fixit # |
Methods render :: Fixit -> Rendering #
Renderable Span # |
Methods render :: Span -> Rendering #
Renderable Caret # |
Methods render :: Caret -> Rendering #
Renderable (Spanned a) # |
Methods render :: Spanned a -> Rendering #
Renderable (Careted a) # |
Methods render :: Careted a -> Rendering #
Renderable (Rendered a) # |
Methods render :: Rendered a -> Rendering #

data Rendered a #

Constructors

a :@ Rendering |

Instances

Functor Rendered # |
Methods fmap :: (a -> b) -> Rendered a -> Rendered b # (<$) :: a -> Rendered b -> Rendered a #
Foldable Rendered # |
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 # |
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 # |
Methods extract :: Rendered a -> a # duplicate :: Rendered a -> Rendered (Rendered a) # extend :: (Rendered a -> b) -> Rendered a -> Rendered b #
ComonadApply Rendered # |
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) # |
Methods showsPrec :: Int -> Rendered a -> ShowS # show :: Rendered a -> String # showList :: [Rendered a] -> ShowS #
HasDelta (Rendered a) # |
Methods delta :: Rendered a -> Delta #
HasBytes (Rendered a) # |
Methods bytes :: Rendered a -> Int64 #
Renderable (Rendered a) # |
Methods render :: Rendered a -> Rendering #

# Carets

data 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; }
                                       ^

Constructors

Caret !Delta !ByteString |

Instances

Eq Caret # |
Methods (==) :: Caret -> Caret -> Bool # (/=) :: Caret -> Caret -> Bool #
Data Caret # |
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 # |
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 # |
Methods showsPrec :: Int -> Caret -> ShowS # show :: Caret -> String # showList :: [Caret] -> ShowS #
Generic Caret # |
Associated Types type Rep Caret :: * -> * # Methods from :: Caret -> Rep Caret x # to :: Rep Caret x -> Caret #
Semigroup Caret # |
Methods (<>) :: Caret -> Caret -> Caret # sconcat :: NonEmpty Caret -> Caret # stimes :: Integral b => b -> Caret -> Caret #
Hashable Caret # |
Methods hashWithSalt :: Int -> Caret -> Int # hash :: Caret -> Int #
HasDelta Caret # |
Methods delta :: Caret -> Delta #
HasBytes Caret # |
Methods bytes :: Caret -> Int64 #
HasCaret Caret # |
Methods caret :: Lens' Caret Caret #
Renderable Caret # |
Methods render :: Caret -> Rendering #
Reducer Caret Rendering # |
Methods unit :: Caret -> Rendering # snoc :: Rendering -> Caret -> Rendering # cons :: Caret -> Rendering -> Rendering #
type Rep Caret # |
type Rep Caret = D1 (MetaData "Caret" "Text.Trifecta.Rendering" "trifecta-1.6-7UEU7iTwd2XJ9FB6jKSAsq" False) (C1 (MetaCons "Caret" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Delta)) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 ByteString))))

class HasCaret t where #

Minimal complete definition

caret

Methods

caret :: Lens' t Caret #

Instances

HasCaret Caret # |
Methods caret :: Lens' Caret Caret #
HasCaret (Careted a) # |
Methods caret :: Lens' (Careted a) Caret #

data Careted a #

Constructors

a :^ Caret |

Instances

Functor Careted # |
Methods fmap :: (a -> b) -> Careted a -> Careted b # (<$) :: a -> Careted b -> Careted a #
Foldable Careted # |
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 # |
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 # |
Methods extract :: Careted a -> a # duplicate :: Careted a -> Careted (Careted a) # extend :: (Careted a -> b) -> Careted a -> Careted b #
ComonadApply Careted # |
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) # |
Methods (==) :: Careted a -> Careted a -> Bool # (/=) :: Careted a -> Careted a -> Bool #
Data a => Data (Careted a) # |
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) # |
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) # |
Methods showsPrec :: Int -> Careted a -> ShowS # show :: Careted a -> String # showList :: [Careted a] -> ShowS #
Generic (Careted a) # |
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) # |
Methods hashWithSalt :: Int -> Careted a -> Int # hash :: Careted a -> Int #
HasDelta (Careted a) # |
Methods delta :: Careted a -> Delta #
HasBytes (Careted a) # |
Methods bytes :: Careted a -> Int64 #
HasCaret (Careted a) # |
Methods caret :: Lens' (Careted a) Caret #
Renderable (Careted a) # |
Methods render :: Careted a -> Rendering #
Reducer (Careted a) Rendering # |
Methods unit :: Careted a -> Rendering # snoc :: Rendering -> Careted a -> Rendering # cons :: Careted a -> Rendering -> Rendering #
type Rep (Careted a) # |
type Rep (Careted a) = D1 (MetaData "Careted" "Text.Trifecta.Rendering" "trifecta-1.6-7UEU7iTwd2XJ9FB6jKSAsq" False) (C1 (MetaCons ":^" (InfixI LeftAssociative 9) False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Caret))))

drawCaret :: Delta -> Delta -> Lines -> Lines #

addCaret :: Delta -> Rendering -> Rendering #

caretEffects :: [SGR] #

renderingCaret :: Delta -> ByteString -> Rendering #

# Spans

data Span #

Constructors

Span !Delta !Delta !ByteString |

Instances

Eq Span # |
Methods (==) :: Span -> Span -> Bool # (/=) :: Span -> Span -> Bool #
Data Span # |
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 # |
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 # |
Methods showsPrec :: Int -> Span -> ShowS # show :: Span -> String # showList :: [Span] -> ShowS #
Generic Span # |
Associated Types type Rep Span :: * -> * # Methods from :: Span -> Rep Span x # to :: Rep Span x -> Span #
Semigroup Span # |
Methods (<>) :: Span -> Span -> Span # sconcat :: NonEmpty Span -> Span # stimes :: Integral b => b -> Span -> Span #
Hashable Span # |
Methods hashWithSalt :: Int -> Span -> Int # hash :: Span -> Int #
HasSpan Span # |
Methods span :: Lens' Span Span #
Renderable Span # |
Methods render :: Span -> Rendering #
Reducer Span Rendering # |
Methods unit :: Span -> Rendering # snoc :: Rendering -> Span -> Rendering # cons :: Span -> Rendering -> Rendering #
type Rep Span # |
type Rep Span = D1 (MetaData "Span" "Text.Trifecta.Rendering" "trifecta-1.6-7UEU7iTwd2XJ9FB6jKSAsq" False) (C1 (MetaCons "Span" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Delta)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Delta)) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 ByteString)))))

class HasSpan t where #

Minimal complete definition

span

Methods

span :: Lens' t Span #

Instances

HasSpan Fixit # |
Methods span :: Lens' Fixit Span #
HasSpan Span # |
Methods span :: Lens' Span Span #
HasSpan (Spanned a) # |
Methods span :: Lens' (Spanned a) Span #

data Spanned a #

Constructors

a :~ Span |

Instances

Functor Spanned # |
Methods fmap :: (a -> b) -> Spanned a -> Spanned b # (<$) :: a -> Spanned b -> Spanned a #
Foldable Spanned # |
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 # |
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 # |
Methods extract :: Spanned a -> a # duplicate :: Spanned a -> Spanned (Spanned a) # extend :: (Spanned a -> b) -> Spanned a -> Spanned b #
ComonadApply Spanned # |
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) # |
Methods (==) :: Spanned a -> Spanned a -> Bool # (/=) :: Spanned a -> Spanned a -> Bool #
Data a => Data (Spanned a) # |
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) # |
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) # |
Methods showsPrec :: Int -> Spanned a -> ShowS # show :: Spanned a -> String # showList :: [Spanned a] -> ShowS #
Generic (Spanned a) # |
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) # |
Methods hashWithSalt :: Int -> Spanned a -> Int # hash :: Spanned a -> Int #
HasSpan (Spanned a) # |
Methods span :: Lens' (Spanned a) Span #
Renderable (Spanned a) # |
Methods render :: Spanned a -> Rendering #
Reducer (Spanned a) Rendering # |
Methods unit :: Spanned a -> Rendering # snoc :: Rendering -> Spanned a -> Rendering # cons :: Spanned a -> Rendering -> Rendering #
type Rep (Spanned a) # |
type Rep (Spanned a) = D1 (MetaData "Spanned" "Text.Trifecta.Rendering" "trifecta-1.6-7UEU7iTwd2XJ9FB6jKSAsq" False) (C1 (MetaCons ":~" (InfixI LeftAssociative 9) False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Span))))

spanEffects :: [SGR] #

drawSpan :: Delta -> Delta -> Delta -> Lines -> Lines #

addSpan :: Delta -> Delta -> Rendering -> Rendering #

    int main(int argc, char ** argv) { int; }
                                       ^~~

# Fixits

data Fixit #

Constructors

Fixit |
Fields _fixitSpan :: !Span _fixitReplacement :: !ByteString

Instances

Eq Fixit # |
Methods (==) :: Fixit -> Fixit -> Bool # (/=) :: Fixit -> Fixit -> Bool #
Data Fixit # |
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 # |
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 # |
Methods showsPrec :: Int -> Fixit -> ShowS # show :: Fixit -> String # showList :: [Fixit] -> ShowS #
Generic Fixit # |
Associated Types type Rep Fixit :: * -> * # Methods from :: Fixit -> Rep Fixit x # to :: Rep Fixit x -> Fixit #
Hashable Fixit # |
Methods hashWithSalt :: Int -> Fixit -> Int # hash :: Fixit -> Int #
HasSpan Fixit # |
Methods span :: Lens' Fixit Span #
Renderable Fixit # |
Methods render :: Fixit -> Rendering #
HasFixit Fixit # |
Methods fixit :: Lens' Fixit Fixit # fixitReplacement :: Lens' Fixit ByteString # fixitSpan :: Lens' Fixit Span #
Reducer Fixit Rendering # |
Methods unit :: Fixit -> Rendering # snoc :: Rendering -> Fixit -> Rendering # cons :: Fixit -> Rendering -> Rendering #
type Rep Fixit # |
type Rep Fixit = D1 (MetaData "Fixit" "Text.Trifecta.Rendering" "trifecta-1.6-7UEU7iTwd2XJ9FB6jKSAsq" False) (C1 (MetaCons "Fixit" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_fixitSpan") SourceUnpack SourceStrict DecidedUnpack) (Rec0 Span)) (S1 (MetaSel (Just Symbol "_fixitReplacement") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ByteString))))

class HasFixit c where #

Minimal complete definition

fixit

Methods

fixit :: Lens' c Fixit #

fixitReplacement :: Lens' c ByteString #

fixitSpan :: Lens' c Span #

Instances

HasFixit Fixit # |
Methods fixit :: Lens' Fixit Fixit # fixitReplacement :: Lens' Fixit ByteString # fixitSpan :: Lens' Fixit Span #

drawFixit :: Delta -> Delta -> String -> Delta -> Lines -> Lines #

addFixit :: Delta -> Delta -> String -> Rendering -> Rendering #

# Drawing primitives

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

draw :: [SGR] -> Int -> Int64 -> String -> Lines -> Lines #

ifNear :: Delta -> (Lines -> Lines) -> Delta -> Lines -> Lines #

(.#) :: (Delta -> Lines -> Lines) -> Rendering -> Rendering #