text-show-instances-3.4: Additional instances for text-show

Copyright(C) 2014-2016 Ryan Scott
LicenseBSD-style (see the file LICENSE)
MaintainerRyan Scott
StabilityProvisional
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

TextShow.Instances

Contents

Description

Additional TextShow, TextShow1, and TextShow2 instances not provided by text-show.

Since: 2

Synopsis

Class re-exports

class TextShow a where #

Conversion of values to Text. Because there are both strict and lazy Text variants, the TextShow class deliberately avoids using Text in its functions. Instead, showbPrec, showb, and showbList all return Builder, an efficient intermediate form that can be converted to either kind of Text.

Builder is a Monoid, so it is useful to use the mappend (or <>) function to combine Builders when creating TextShow instances. As an example:

import Data.Monoid
import TextShow

data Example = Example Int Int
instance TextShow Example where
    showb (Example i1 i2) = showb i1 <> showbSpace <> showb i2

If you do not want to create TextShow instances manually, you can alternatively use the TextShow.TH module to automatically generate default TextShow instances using Template Haskell, or the TextShow.Generic module to quickly define TextShow instances using genericShowbPrec.

Since: 2

Minimal complete definition

showbPrec | showb

Instances

Show a => TextShow (FromStringShow a) 
TextShow a => TextShow (FromTextShow a) 
(Show1 f, Show a) => TextShow (FromStringShow1 * f a)

Not available if using transformers-0.4

(TextShow1 f, TextShow a) => TextShow (FromTextShow1 * f a) 
(Show2 f, Show a, Show b) => TextShow (FromStringShow2 * * f a b)

Not available if using transformers-0.4

(TextShow2 f, TextShow a, TextShow b) => TextShow (FromTextShow2 * * f a b) 

class TextShow1 f where #

Lifting of the TextShow class to unary type constructors.

Since: 2

Minimal complete definition

liftShowbPrec

Instances

TextShow1 FromStringShow 

Methods

liftShowbPrec :: (Int -> a -> Builder) -> ([a] -> Builder) -> Int -> FromStringShow a -> Builder #

liftShowbList :: (Int -> a -> Builder) -> ([a] -> Builder) -> [FromStringShow a] -> Builder #

TextShow1 FromTextShow 

Methods

liftShowbPrec :: (Int -> a -> Builder) -> ([a] -> Builder) -> Int -> FromTextShow a -> Builder #

liftShowbList :: (Int -> a -> Builder) -> ([a] -> Builder) -> [FromTextShow a] -> Builder #

Show1 f => TextShow1 (FromStringShow1 * f)

Not available if using transformers-0.4

Methods

liftShowbPrec :: (Int -> a -> Builder) -> ([a] -> Builder) -> Int -> FromStringShow1 * f a -> Builder #

liftShowbList :: (Int -> a -> Builder) -> ([a] -> Builder) -> [FromStringShow1 * f a] -> Builder #

TextShow1 f => TextShow1 (FromTextShow1 * f) 

Methods

liftShowbPrec :: (Int -> a -> Builder) -> ([a] -> Builder) -> Int -> FromTextShow1 * f a -> Builder #

liftShowbList :: (Int -> a -> Builder) -> ([a] -> Builder) -> [FromTextShow1 * f a] -> Builder #

(Show2 f, Show a) => TextShow1 (FromStringShow2 * * f a)

Not available if using transformers-0.4

Methods

liftShowbPrec :: (Int -> a -> Builder) -> ([a] -> Builder) -> Int -> FromStringShow2 * * f a a -> Builder #

liftShowbList :: (Int -> a -> Builder) -> ([a] -> Builder) -> [FromStringShow2 * * f a a] -> Builder #

(TextShow2 f, TextShow a) => TextShow1 (FromTextShow2 * * f a) 

Methods

liftShowbPrec :: (Int -> a -> Builder) -> ([a] -> Builder) -> Int -> FromTextShow2 * * f a a -> Builder #

liftShowbList :: (Int -> a -> Builder) -> ([a] -> Builder) -> [FromTextShow2 * * f a a] -> Builder #

class TextShow2 f where #

Lifting of the TextShow class to binary type constructors.

Since: 2

Minimal complete definition

liftShowbPrec2

Instances

Show2 f => TextShow2 (FromStringShow2 * * f)

Not available if using transformers-0.4

Methods

liftShowbPrec2 :: (Int -> a -> Builder) -> ([a] -> Builder) -> (Int -> b -> Builder) -> ([b] -> Builder) -> Int -> FromStringShow2 * * f a b -> Builder #

liftShowbList2 :: (Int -> a -> Builder) -> ([a] -> Builder) -> (Int -> b -> Builder) -> ([b] -> Builder) -> [FromStringShow2 * * f a b] -> Builder #

TextShow2 f => TextShow2 (FromTextShow2 * * f) 

Methods

liftShowbPrec2 :: (Int -> a -> Builder) -> ([a] -> Builder) -> (Int -> b -> Builder) -> ([b] -> Builder) -> Int -> FromTextShow2 * * f a b -> Builder #

liftShowbList2 :: (Int -> a -> Builder) -> ([a] -> Builder) -> (Int -> b -> Builder) -> ([b] -> Builder) -> [FromTextShow2 * * f a b] -> Builder #

Module re-export

module TextShow