HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleformatting-7.2.0Haskell2010

Formatting.FromBuilder

  • 1 class
  • 1 value
  • Packageformatting-7.2.0
  • Exports2
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceFromBuilder.hs
classclass FromBuilder a where
#

Anything that can be created from a Builder. This class makes it easier to add formatting to other API's. See formatted for some examples of this class in action.

Methods

Instances4FromBuilder
valueformatted :: FromBuilder t => (t -> o) -> Format o a -> a
#

Makes it easy to add formatting to any api that is expecting a builder, a strict or lazy text, or a string. It is essentially (flip runFormat), but with a more generous type due to the typeclass.

For example: >>> formatted TL.putStr ("x is: " % int % "n") 7 x is: 7 >>> formatted T.putStr ("x is: " % int % "n") 7 x is: 7 >>> formatted (id TL.Text) ("x is: " % int % "n") 7 "x is: 7n" >>> formatted (id T.Text) ("x is: " % int % "n") 7 "x is: 7n"