HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleoptparse-applicative-0.18.1.0Haskell98

Options.Applicative.Help.Chunk

  • 1 type
  • 11 values
newtypenewtype Chunk a
#

The free monoid on a semigroup a.

Constructors

Instances9Monad, Functor, Applicative, Alternative, MonadPlus, Eq, …
  • Monad ChunkDefined in optparse-applicative-0.18.1.0 · Options.Applicative.Help.Chunk
  • Functor ChunkDefined in optparse-applicative-0.18.1.0 · Options.Applicative.Help.Chunk
  • Applicative ChunkDefined in optparse-applicative-0.18.1.0 · Options.Applicative.Help.Chunk
  • Alternative ChunkDefined in optparse-applicative-0.18.1.0 · Options.Applicative.Help.Chunk
  • MonadPlus ChunkDefined in optparse-applicative-0.18.1.0 · Options.Applicative.Help.Chunk
  • Eq a => Eq (Chunk a)Defined in optparse-applicative-0.18.1.0 · Options.Applicative.Help.Chunk
  • Show a => Show (Chunk a)Defined in optparse-applicative-0.18.1.0 · Options.Applicative.Help.Chunk
  • Semigroup a => Semigroup (Chunk a)Defined in optparse-applicative-0.18.1.0 · Options.Applicative.Help.Chunk
  • Semigroup a => Monoid (Chunk a)Defined in optparse-applicative-0.18.1.0 · Options.Applicative.Help.Chunk
valuechunked :: (a -> a -> a) -> Chunk a -> Chunk a -> Chunk a
#

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

Note that this is not the same as liftA2.

value(<<+>>) :: Chunk Doc -> Chunk Doc -> Chunk Doc
#

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.

valueisEmpty :: Chunk a -> Bool
#

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

valueparagraph :: String -> Chunk Doc
#

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
valueextractChunk :: Monoid a => Chunk a -> a
#

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