fmt-0.6.1.2: A new formatting library
Safe Haskell None
Language Haskell2010

Fmt.Internal.Generic

Synopsis

Documentation

>>> import Fmt

genericF :: ( Generic a, GBuildable ( Rep a)) => a -> Builder Source #

Format an arbitrary value without requiring a Buildable instance:

>>> data Foo = Foo { x :: Bool, y :: [Int] } deriving Generic
>>> fmt (genericF (Foo True [1,2,3]))
Foo:
  x: True
  y: [1, 2, 3]

It works for non-record constructors too:

>>> data Bar = Bar Bool [Int] deriving Generic
>>> fmtLn (genericF (Bar True [1,2,3]))
<Bar: True, [1, 2, 3]>

Any fields inside the type must either be Buildable or one of the following types:

The exact format of genericF might change in future versions, so don't rely on it. It's merely a convenience function.

class Buildable' a where Source #

A more powerful Buildable used for genericF . Can build functions, tuples, lists, maps, etc., as well as combinations thereof.

Instances

Instances details
Buildable' () Source #
Instance details

Defined in Fmt.Internal.Generic

Buildable a => Buildable' a Source #
Instance details

Defined in Fmt.Internal.Generic

Buildable' IntSet Source #
Instance details

Defined in Fmt.Internal.Generic

Buildable' [ Char ] Source #
Instance details

Defined in Fmt.Internal.Generic

Buildable' a => Buildable' [a] Source #
Instance details

Defined in Fmt.Internal.Generic

Buildable' a => Buildable' ( Maybe a) Source #
Instance details

Defined in Fmt.Internal.Generic

Buildable' a => Buildable' ( NonEmpty a) Source #
Instance details

Defined in Fmt.Internal.Generic

Buildable' v => Buildable' ( IntMap v) Source #
Instance details

Defined in Fmt.Internal.Generic

Buildable' a => Buildable' ( Seq a) Source #
Instance details

Defined in Fmt.Internal.Generic

Buildable' v => Buildable' ( Set v) Source #
Instance details

Defined in Fmt.Internal.Generic

Buildable' (a -> b) Source #
Instance details

Defined in Fmt.Internal.Generic

Methods

build' :: (a -> b) -> Builder Source #

( Buildable' a, Buildable' b) => Buildable' ( Either a b) Source #
Instance details

Defined in Fmt.Internal.Generic

( Buildable' a1, Buildable' a2) => Buildable' (a1, a2) Source #
Instance details

Defined in Fmt.Internal.Generic

Methods

build' :: (a1, a2) -> Builder Source #

( Buildable' k, Buildable' v) => Buildable' ( Map k v) Source #
Instance details

Defined in Fmt.Internal.Generic

( Buildable' a1, Buildable' a2, Buildable' a3) => Buildable' (a1, a2, a3) Source #
Instance details

Defined in Fmt.Internal.Generic

Methods

build' :: (a1, a2, a3) -> Builder Source #

( Buildable' a1, Buildable' a2, Buildable' a3, Buildable' a4) => Buildable' (a1, a2, a3, a4) Source #
Instance details

Defined in Fmt.Internal.Generic

Methods

build' :: (a1, a2, a3, a4) -> Builder Source #

( Buildable' a1, Buildable' a2, Buildable' a3, Buildable' a4, Buildable' a5) => Buildable' (a1, a2, a3, a4, a5) Source #
Instance details

Defined in Fmt.Internal.Generic

Methods

build' :: (a1, a2, a3, a4, a5) -> Builder Source #

( Buildable' a1, Buildable' a2, Buildable' a3, Buildable' a4, Buildable' a5, Buildable' a6) => Buildable' (a1, a2, a3, a4, a5, a6) Source #
Instance details

Defined in Fmt.Internal.Generic

Methods

build' :: (a1, a2, a3, a4, a5, a6) -> Builder Source #

( Buildable' a1, Buildable' a2, Buildable' a3, Buildable' a4, Buildable' a5, Buildable' a6, Buildable' a7) => Buildable' (a1, a2, a3, a4, a5, a6, a7) Source #
Instance details

Defined in Fmt.Internal.Generic

Methods

build' :: (a1, a2, a3, a4, a5, a6, a7) -> Builder Source #

( Buildable' a1, Buildable' a2, Buildable' a3, Buildable' a4, Buildable' a5, Buildable' a6, Buildable' a7, Buildable' a8) => Buildable' (a1, a2, a3, a4, a5, a6, a7, a8) Source #
Instance details

Defined in Fmt.Internal.Generic

Methods

build' :: (a1, a2, a3, a4, a5, a6, a7, a8) -> Builder Source #