optparse-applicative-0.8.1: Utilities and combinators for parsing command line options

Safe HaskellSafe-Inferred




mappendWith :: Monoid a => a -> a -> a -> aSource

newtype Chunk a Source

The free monoid on a semigroup a.




unChunk :: Maybe a

chunked :: (a -> a -> a) -> Chunk a -> Chunk a -> Chunk aSource

Given a semigroup structure on a, return a monoid structure on 'Chunk a'.

Note that this is not the same as liftA2.

listToChunk :: Monoid a => [a] -> Chunk aSource

Concatenate a list into a Chunk. listToChunk satisfies:

 isEmpty . listToChunk = null
 listToChunk = mconcat . fmap pure

(<<+>>) :: Chunk Doc -> Chunk Doc -> Chunk DocSource

Concatenate two Chunks with a space in between. If one is empty, this just returns the other one.

Unlike <+> for Doc, this operation has a unit element, namely the empty Chunk.

(<</>>) :: Chunk Doc -> Chunk Doc -> Chunk DocSource

Concatenate two Chunks with a softline in between. This is exactly like <<+>>, but uses a softline instead of a space.

vcatChunks :: [Chunk Doc] -> Chunk DocSource

Concatenate Chunks vertically.

vsepChunks :: [Chunk Doc] -> Chunk DocSource

Concatenate Chunks vertically separated by empty lines.

isEmpty :: Chunk a -> BoolSource

Whether a Chunk is empty. Note that something like 'pure mempty' is not considered an empty chunk, even though the underlying Doc is empty.

stringChunk :: String -> Chunk DocSource

Convert a String into a Chunk. This satisfies:

 isEmpty . stringChunk = null
 extractChunk . stringChunk = string

paragraph :: String -> Chunk DocSource

Convert a paragraph into a Chunk. The resulting chunk is composed by the words of the original paragraph separated by softlines, so it will be automatically word-wrapped when rendering the underlying document.

This satisfies:

 isEmpty . paragraph = null . words

extractChunk :: Monoid a => Chunk a -> aSource

Part of a constrained comonad instance.

This is the counit of the adjunction between Chunk and the forgetful functor from monoids to semigroups. It satisfies:

 extractChunk . pure = id
 extractChunk . fmap pure = id

tabulate :: [(Doc, Doc)] -> Chunk DocSource

Display pairs of strings in a table.