Safe Haskell | None |
---|---|
Language | Haskell2010 |
Patat.PrettyPrint.Internal
Description
This is a small pretty-printing library.
Synopsis
- data Control
- data Chunk
- = StringChunk [SGR] String
- | NewlineChunk
- | ControlChunk Control
- type Chunks = [Chunk]
- chunkToString :: Chunk -> String
- chunkLines :: Chunks -> [Chunks]
- data DocE d
- chunkToDocE :: Chunk -> DocE Doc
- data Indentation a = Indentation Int a
- newtype Doc = Doc {}
- docToChunks :: Doc -> Chunks
- toString :: Doc -> String
- dimensions :: Doc -> (Int, Int)
- null :: Doc -> Bool
- hPutDoc :: Handle -> Doc -> IO ()
- putDoc :: Doc -> IO ()
- mkDoc :: DocE Doc -> Doc
- string :: String -> Doc
Documentation
A simple chunk of text. All ANSI codes are "reset" after printing.
Constructors
StringChunk [SGR] String | |
NewlineChunk | |
ControlChunk Control |
chunkToString :: Chunk -> String Source #
chunkLines :: Chunks -> [Chunks] Source #
Constructors
String String | |
Softspace | |
Hardspace | |
Softline | |
Hardline | |
WrapAt | |
Ansi | |
Indent | |
Fields
| |
Control Control |
data Indentation a Source #
Constructors
Indentation Int a |
Instances
Foldable Indentation Source # | |
Defined in Patat.PrettyPrint.Internal Methods fold :: Monoid m => Indentation m -> m foldMap :: Monoid m => (a -> m) -> Indentation a -> m foldMap' :: Monoid m => (a -> m) -> Indentation a -> m foldr :: (a -> b -> b) -> b -> Indentation a -> b foldr' :: (a -> b -> b) -> b -> Indentation a -> b foldl :: (b -> a -> b) -> b -> Indentation a -> b foldl' :: (b -> a -> b) -> b -> Indentation a -> b foldr1 :: (a -> a -> a) -> Indentation a -> a foldl1 :: (a -> a -> a) -> Indentation a -> a toList :: Indentation a -> [a] null :: Indentation a -> Bool length :: Indentation a -> Int elem :: Eq a => a -> Indentation a -> Bool maximum :: Ord a => Indentation a -> a minimum :: Ord a => Indentation a -> a sum :: Num a => Indentation a -> a product :: Num a => Indentation a -> a | |
Traversable Indentation Source # | |
Defined in Patat.PrettyPrint.Internal Methods traverse :: Applicative f => (a -> f b) -> Indentation a -> f (Indentation b) sequenceA :: Applicative f => Indentation (f a) -> f (Indentation a) mapM :: Monad m => (a -> m b) -> Indentation a -> m (Indentation b) sequence :: Monad m => Indentation (m a) -> m (Indentation a) | |
Functor Indentation Source # | |
Defined in Patat.PrettyPrint.Internal Methods fmap :: (a -> b) -> Indentation a -> Indentation b (<$) :: a -> Indentation b -> Indentation a |
docToChunks :: Doc -> Chunks Source #
dimensions :: Doc -> (Int, Int) Source #
Returns the rows and columns necessary to render this document