text-show-3.7.4: Efficient conversion of values into Text

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

TextShow.Generic

Contents

Description

Generic versions of TextShow and TextShow1 class functions, as an alternative to TextShow.TH, which uses Template Haskell. Because there is no Generic2 class, TextShow2 cannot be implemented generically.

This implementation is loosely based off of the Generics.Deriving.Show module from the generic-deriving library.

Since: 2

Synopsis

Generic adapter newtypes

newtype FromGeneric a #

An adapter newtype, suitable for DerivingVia. The TextShow instance for FromGeneric leverages a Generic-based default. That is,

showbPrec p (FromGeneric x) = genericShowbPrec p x

Since: 3.7.4

Constructors

FromGeneric 

Fields

Instances
Functor FromGeneric # 
Instance details

Defined in TextShow.Generic

Methods

fmap :: (a -> b) -> FromGeneric a -> FromGeneric b #

(<$) :: a -> FromGeneric b -> FromGeneric a #

Foldable FromGeneric # 
Instance details

Defined in TextShow.Generic

Methods

fold :: Monoid m => FromGeneric m -> m #

foldMap :: Monoid m => (a -> m) -> FromGeneric a -> m #

foldr :: (a -> b -> b) -> b -> FromGeneric a -> b #

foldr' :: (a -> b -> b) -> b -> FromGeneric a -> b #

foldl :: (b -> a -> b) -> b -> FromGeneric a -> b #

foldl' :: (b -> a -> b) -> b -> FromGeneric a -> b #

foldr1 :: (a -> a -> a) -> FromGeneric a -> a #

foldl1 :: (a -> a -> a) -> FromGeneric a -> a #

toList :: FromGeneric a -> [a] #

null :: FromGeneric a -> Bool #

length :: FromGeneric a -> Int #

elem :: Eq a => a -> FromGeneric a -> Bool #

maximum :: Ord a => FromGeneric a -> a #

minimum :: Ord a => FromGeneric a -> a #

sum :: Num a => FromGeneric a -> a #

product :: Num a => FromGeneric a -> a #

Traversable FromGeneric # 
Instance details

Defined in TextShow.Generic

Methods

traverse :: Applicative f => (a -> f b) -> FromGeneric a -> f (FromGeneric b) #

sequenceA :: Applicative f => FromGeneric (f a) -> f (FromGeneric a) #

mapM :: Monad m => (a -> m b) -> FromGeneric a -> m (FromGeneric b) #

sequence :: Monad m => FromGeneric (m a) -> m (FromGeneric a) #

Eq a => Eq (FromGeneric a) # 
Instance details

Defined in TextShow.Generic

Data a => Data (FromGeneric a) # 
Instance details

Defined in TextShow.Generic

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FromGeneric a -> c (FromGeneric a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (FromGeneric a) #

toConstr :: FromGeneric a -> Constr #

dataTypeOf :: FromGeneric a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (FromGeneric a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (FromGeneric a)) #

gmapT :: (forall b. Data b => b -> b) -> FromGeneric a -> FromGeneric a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FromGeneric a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FromGeneric a -> r #

gmapQ :: (forall d. Data d => d -> u) -> FromGeneric a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> FromGeneric a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> FromGeneric a -> m (FromGeneric a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FromGeneric a -> m (FromGeneric a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FromGeneric a -> m (FromGeneric a) #

Ord a => Ord (FromGeneric a) # 
Instance details

Defined in TextShow.Generic

Read a => Read (FromGeneric a) # 
Instance details

Defined in TextShow.Generic

Show a => Show (FromGeneric a) # 
Instance details

Defined in TextShow.Generic

Generic (FromGeneric a) # 
Instance details

Defined in TextShow.Generic

Associated Types

type Rep (FromGeneric a) :: * -> * #

Methods

from :: FromGeneric a -> Rep (FromGeneric a) x #

to :: Rep (FromGeneric a) x -> FromGeneric a #

Lift a => Lift (FromGeneric a) # 
Instance details

Defined in TextShow.Generic

Methods

lift :: FromGeneric a -> Q Exp #

(Generic a, GTextShowB Zero (Rep a)) => TextShow (FromGeneric a) #

Since: 3.7.4

Instance details

Defined in TextShow.Generic

Generic1 FromGeneric # 
Instance details

Defined in TextShow.Generic

Associated Types

type Rep1 FromGeneric :: k -> * #

type Rep (FromGeneric a) # 
Instance details

Defined in TextShow.Generic

type Rep (FromGeneric a) = D1 (MetaData "FromGeneric" "TextShow.Generic" "text-show-3.7.4-Hysro43h9pL1oxFgxL8lBw" True) (C1 (MetaCons "FromGeneric" PrefixI True) (S1 (MetaSel (Just "fromGeneric") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))
type Rep1 FromGeneric # 
Instance details

Defined in TextShow.Generic

type Rep1 FromGeneric = D1 (MetaData "FromGeneric" "TextShow.Generic" "text-show-3.7.4-Hysro43h9pL1oxFgxL8lBw" True) (C1 (MetaCons "FromGeneric" PrefixI True) (S1 (MetaSel (Just "fromGeneric") NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))

newtype FromGeneric1 f a #

An adapter newtype, suitable for DerivingVia. The TextShow1 instance for FromGeneric1 leverages a Generic1-based default. That is,

liftShowbPrec sp sl p (FromGeneric1 x) = genericLiftShowbPrec sp sl p x

Since: 3.7.4

Constructors

FromGeneric1 

Fields

Instances
Generic1 (FromGeneric1 f :: k -> *) # 
Instance details

Defined in TextShow.Generic

Associated Types

type Rep1 (FromGeneric1 f) :: k -> * #

Methods

from1 :: FromGeneric1 f a -> Rep1 (FromGeneric1 f) a #

to1 :: Rep1 (FromGeneric1 f) a -> FromGeneric1 f a #

Functor f => Functor (FromGeneric1 f) # 
Instance details

Defined in TextShow.Generic

Methods

fmap :: (a -> b) -> FromGeneric1 f a -> FromGeneric1 f b #

(<$) :: a -> FromGeneric1 f b -> FromGeneric1 f a #

Foldable f => Foldable (FromGeneric1 f) # 
Instance details

Defined in TextShow.Generic

Methods

fold :: Monoid m => FromGeneric1 f m -> m #

foldMap :: Monoid m => (a -> m) -> FromGeneric1 f a -> m #

foldr :: (a -> b -> b) -> b -> FromGeneric1 f a -> b #

foldr' :: (a -> b -> b) -> b -> FromGeneric1 f a -> b #

foldl :: (b -> a -> b) -> b -> FromGeneric1 f a -> b #

foldl' :: (b -> a -> b) -> b -> FromGeneric1 f a -> b #

foldr1 :: (a -> a -> a) -> FromGeneric1 f a -> a #

foldl1 :: (a -> a -> a) -> FromGeneric1 f a -> a #

toList :: FromGeneric1 f a -> [a] #

null :: FromGeneric1 f a -> Bool #

length :: FromGeneric1 f a -> Int #

elem :: Eq a => a -> FromGeneric1 f a -> Bool #

maximum :: Ord a => FromGeneric1 f a -> a #

minimum :: Ord a => FromGeneric1 f a -> a #

sum :: Num a => FromGeneric1 f a -> a #

product :: Num a => FromGeneric1 f a -> a #

Traversable f => Traversable (FromGeneric1 f) # 
Instance details

Defined in TextShow.Generic

Methods

traverse :: Applicative f0 => (a -> f0 b) -> FromGeneric1 f a -> f0 (FromGeneric1 f b) #

sequenceA :: Applicative f0 => FromGeneric1 f (f0 a) -> f0 (FromGeneric1 f a) #

mapM :: Monad m => (a -> m b) -> FromGeneric1 f a -> m (FromGeneric1 f b) #

sequence :: Monad m => FromGeneric1 f (m a) -> m (FromGeneric1 f a) #

(Generic1 f, GTextShowB One (Rep1 f)) => TextShow1 (FromGeneric1 f) #

Since: 3.7.4

Instance details

Defined in TextShow.Generic

Methods

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

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

Eq (f a) => Eq (FromGeneric1 f a) # 
Instance details

Defined in TextShow.Generic

Methods

(==) :: FromGeneric1 f a -> FromGeneric1 f a -> Bool #

(/=) :: FromGeneric1 f a -> FromGeneric1 f a -> Bool #

(Data (f a), Typeable f, Typeable a) => Data (FromGeneric1 f a) # 
Instance details

Defined in TextShow.Generic

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FromGeneric1 f a -> c (FromGeneric1 f a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (FromGeneric1 f a) #

toConstr :: FromGeneric1 f a -> Constr #

dataTypeOf :: FromGeneric1 f a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (FromGeneric1 f a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (FromGeneric1 f a)) #

gmapT :: (forall b. Data b => b -> b) -> FromGeneric1 f a -> FromGeneric1 f a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FromGeneric1 f a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FromGeneric1 f a -> r #

gmapQ :: (forall d. Data d => d -> u) -> FromGeneric1 f a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> FromGeneric1 f a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> FromGeneric1 f a -> m (FromGeneric1 f a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FromGeneric1 f a -> m (FromGeneric1 f a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FromGeneric1 f a -> m (FromGeneric1 f a) #

Ord (f a) => Ord (FromGeneric1 f a) # 
Instance details

Defined in TextShow.Generic

Read (f a) => Read (FromGeneric1 f a) # 
Instance details

Defined in TextShow.Generic

Show (f a) => Show (FromGeneric1 f a) # 
Instance details

Defined in TextShow.Generic

Generic (FromGeneric1 f a) # 
Instance details

Defined in TextShow.Generic

Associated Types

type Rep (FromGeneric1 f a) :: * -> * #

Methods

from :: FromGeneric1 f a -> Rep (FromGeneric1 f a) x #

to :: Rep (FromGeneric1 f a) x -> FromGeneric1 f a #

Lift (f a) => Lift (FromGeneric1 f a) # 
Instance details

Defined in TextShow.Generic

Methods

lift :: FromGeneric1 f a -> Q Exp #

type Rep1 (FromGeneric1 f :: k -> *) # 
Instance details

Defined in TextShow.Generic

type Rep1 (FromGeneric1 f :: k -> *) = D1 (MetaData "FromGeneric1" "TextShow.Generic" "text-show-3.7.4-Hysro43h9pL1oxFgxL8lBw" True) (C1 (MetaCons "FromGeneric1" PrefixI True) (S1 (MetaSel (Just "fromGeneric1") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 f)))
type Rep (FromGeneric1 f a) # 
Instance details

Defined in TextShow.Generic

type Rep (FromGeneric1 f a) = D1 (MetaData "FromGeneric1" "TextShow.Generic" "text-show-3.7.4-Hysro43h9pL1oxFgxL8lBw" True) (C1 (MetaCons "FromGeneric1" PrefixI True) (S1 (MetaSel (Just "fromGeneric1") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (f a))))

Generic show functions

TextShow instances can be easily defined for data types that are Generic instances. If you are using GHC 8.6 or later, the easiest way to do this is to use the DerivingVia extension.

{-# LANGUAGE DeriveGeneric, DerivingVia #-}
import GHC.Generics
import TextShow
import TextShow.Generic

data D a = D a
  deriving (Generic, Generic1)
  deriving TextShow  via FromGeneric  (D a)
  deriving TextShow1 via FromGeneric1 D

Or, if you are using a version of GHC older than 8.6, one can alternatively define these instances like so:

instance TextShow a => TextShow (D a) where
    showbPrec = genericShowbPrec

instance TextShow1 D where
    liftShowbPrec = genericLiftShowbPrec

Understanding a compiler error

Suppose you intend to define a TextShow instance via FromGeneric:

data Oops = Oops
  deriving TextShow via FromGeneric Oops
    -- forgot to add "deriving Generic" here!

If you forget to add a deriving Generic clause to your data type, at compile-time, you might get an error message that begins roughly as follows:

No instance for (GTextShowB Zero (Rep Oops))

This error can be confusing, but don't let it intimidate you. The correct fix is simply to add the missing "deriving Generic" clause.

Similarly, if the compiler complains about not having an instance for (GTextShowB One (Rep1 Oops1)), add a "deriving Generic1" clause.

genericShowt :: (Generic a, GTextShowT Zero (Rep a)) => a -> Text #

A Generic implementation of showt.

Since: 2

genericShowtl :: (Generic a, GTextShowTL Zero (Rep a)) => a -> Text #

A Generic implementation of showtl.

Since: 2

genericShowtPrec :: (Generic a, GTextShowT Zero (Rep a)) => Int -> a -> Text #

A Generic implementation of showPrect.

Since: 2

genericShowtlPrec :: (Generic a, GTextShowTL Zero (Rep a)) => Int -> a -> Text #

A Generic implementation of showtlPrec.

Since: 2

genericShowtList :: (Generic a, GTextShowT Zero (Rep a)) => [a] -> Text #

A Generic implementation of showtList.

Since: 2

genericShowtlList :: (Generic a, GTextShowTL Zero (Rep a)) => [a] -> Text #

A Generic implementation of showtlList.

Since: 2

genericShowb :: (Generic a, GTextShowB Zero (Rep a)) => a -> Builder #

A Generic implementation of showb.

Since: 2

genericShowbPrec :: (Generic a, GTextShowB Zero (Rep a)) => Int -> a -> Builder #

A Generic implementation of showbPrec.

Since: 2

genericShowbList :: (Generic a, GTextShowB Zero (Rep a)) => [a] -> Builder #

A Generic implementation of showbList.

Since: 2

genericPrintT :: (Generic a, GTextShowT Zero (Rep a)) => a -> IO () #

A Generic implementation of printT.

Since: 2

genericPrintTL :: (Generic a, GTextShowTL Zero (Rep a)) => a -> IO () #

A Generic implementation of printTL.

Since: 2

genericHPrintT :: (Generic a, GTextShowT Zero (Rep a)) => Handle -> a -> IO () #

A Generic implementation of hPrintT.

Since: 2

genericHPrintTL :: (Generic a, GTextShowTL Zero (Rep a)) => Handle -> a -> IO () #

A Generic implementation of hPrintTL.

Since: 2

genericLiftShowbPrec :: (Generic1 f, GTextShowB One (Rep1 f)) => (Int -> a -> Builder) -> ([a] -> Builder) -> Int -> f a -> Builder #

A Generic1 implementation of genericLiftShowbPrec.

Since: 2

genericShowbPrec1 :: (Generic a, Generic1 f, GTextShowB Zero (Rep a), GTextShowB One (Rep1 f)) => Int -> f a -> Builder #

A 'Generic'/'Generic1' implementation of showbPrec1.

Since: 2

Internals

Builder

class GTextShowB arity f where #

Class of generic representation types that can be converted to a Builder. The arity type variable indicates which type class is used. GTextShowB Zero indicates TextShow behavior, and GTextShowB One indicates TextShow1 behavior. Since: 3.4

Minimal complete definition

gShowbPrec

Methods

gShowbPrec :: ShowFunsB arity a -> Int -> f a -> Builder #

This is used as the default generic implementation of showbPrec (if the arity is Zero) or liftShowbPrec (if the arity is One).

Instances
GTextShowB One (V1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrec :: ShowFunsB One a -> Int -> V1 a -> Builder #

GTextShowB Zero (V1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrec :: ShowFunsB Zero a -> Int -> V1 a -> Builder #

(Constructor c, GTextShowConB arity f, IsNullary f) => GTextShowB arity (C1 c f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrec :: ShowFunsB arity a -> Int -> C1 c f a -> Builder #

(GTextShowB arity f, GTextShowB arity g) => GTextShowB arity (f :+: g) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrec :: ShowFunsB arity a -> Int -> (f :+: g) a -> Builder #

GTextShowB arity f => GTextShowB arity (D1 d f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrec :: ShowFunsB arity a -> Int -> D1 d f a -> Builder #

class GTextShowConB arity f where #

Class of generic representation types for which the ConType has been determined. The arity type variable indicates which type class is used. GTextShowConB Zero indicates TextShow behavior, and GTextShowConB One indicates TextShow1 behavior.

Minimal complete definition

gShowbPrecCon

Methods

gShowbPrecCon :: ConType -> ShowFunsB arity a -> Int -> f a -> Builder #

Convert value of a specific ConType to a Builder with the given precedence.

Instances
GTextShowConB One Par1 # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB One a -> Int -> Par1 a -> Builder #

GTextShowConB arity (UWord :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB arity a -> Int -> UWord a -> Builder #

GTextShowConB arity (UInt :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB arity a -> Int -> UInt a -> Builder #

GTextShowConB arity (UFloat :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB arity a -> Int -> UFloat a -> Builder #

GTextShowConB arity (UDouble :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB arity a -> Int -> UDouble a -> Builder #

GTextShowConB arity (UChar :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB arity a -> Int -> UChar a -> Builder #

GTextShowConB arity (U1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB arity a -> Int -> U1 a -> Builder #

TextShow1 f => GTextShowConB One (Rec1 f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB One a -> Int -> Rec1 f a -> Builder #

(GTextShowConB arity f, GTextShowConB arity g) => GTextShowConB arity (f :*: g) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB arity a -> Int -> (f :*: g) a -> Builder #

(Selector s, GTextShowConB arity f) => GTextShowConB arity (S1 s f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB arity a -> Int -> S1 s f a -> Builder #

TextShow c => GTextShowConB arity (K1 i c :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB arity a -> Int -> K1 i c a -> Builder #

(TextShow1 f, GTextShowConB One g) => GTextShowConB One (f :.: g) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB One a -> Int -> (f :.: g) a -> Builder #

data ShowFunsB arity a where #

A ShowFunsB value either stores nothing (for TextShow) or it stores the two function arguments that show occurrences of the type parameter (for TextShow1). Since: 3.4

Constructors

NoShowFunsB :: ShowFunsB Zero a 
Show1FunsB :: (Int -> a -> Builder) -> ([a] -> Builder) -> ShowFunsB One a 
Instances
Contravariant (ShowFunsB arity) # 
Instance details

Defined in TextShow.Generic

Methods

contramap :: (a -> b) -> ShowFunsB arity b -> ShowFunsB arity a #

(>$) :: b -> ShowFunsB arity b -> ShowFunsB arity a #

Strict Text

class GTextShowT arity f where #

Class of generic representation types that can be converted to a Text. The arity type variable indicates which type class is used. GTextShowT Zero indicates TextShow behavior, and GTextShowT One indicates TextShow1 behavior. Since: 3.4

Minimal complete definition

gShowtPrec

Methods

gShowtPrec :: ShowFunsT arity a -> Int -> f a -> Text #

This is used as the default generic implementation of showtPrec (if the arity is Zero) or liftShowtPrec (if the arity is One).

Instances
GTextShowT One (V1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrec :: ShowFunsT One a -> Int -> V1 a -> Text #

GTextShowT Zero (V1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrec :: ShowFunsT Zero a -> Int -> V1 a -> Text #

(Constructor c, GTextShowConT arity f, IsNullary f) => GTextShowT arity (C1 c f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrec :: ShowFunsT arity a -> Int -> C1 c f a -> Text #

(GTextShowT arity f, GTextShowT arity g) => GTextShowT arity (f :+: g) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrec :: ShowFunsT arity a -> Int -> (f :+: g) a -> Text #

GTextShowT arity f => GTextShowT arity (D1 d f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrec :: ShowFunsT arity a -> Int -> D1 d f a -> Text #

class GTextShowConT arity f where #

Class of generic representation types for which the ConType has been determined. The arity type variable indicates which type class is used. GTextShowConT Zero indicates TextShow behavior, and GTextShowConT One indicates TextShow1 behavior.

Minimal complete definition

gShowtPrecCon

Methods

gShowtPrecCon :: ConType -> ShowFunsT arity a -> Int -> f a -> Text #

Convert value of a specific ConType to a Text with the given precedence.

Instances
GTextShowConT One Par1 # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT One a -> Int -> Par1 a -> Text #

GTextShowConT arity (UWord :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT arity a -> Int -> UWord a -> Text #

GTextShowConT arity (UInt :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT arity a -> Int -> UInt a -> Text #

GTextShowConT arity (UFloat :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT arity a -> Int -> UFloat a -> Text #

GTextShowConT arity (UDouble :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT arity a -> Int -> UDouble a -> Text #

GTextShowConT arity (UChar :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT arity a -> Int -> UChar a -> Text #

GTextShowConT arity (U1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT arity a -> Int -> U1 a -> Text #

TextShow1 f => GTextShowConT One (Rec1 f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT One a -> Int -> Rec1 f a -> Text #

(GTextShowConT arity f, GTextShowConT arity g) => GTextShowConT arity (f :*: g) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT arity a -> Int -> (f :*: g) a -> Text #

(Selector s, GTextShowConT arity f) => GTextShowConT arity (S1 s f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT arity a -> Int -> S1 s f a -> Text #

TextShow c => GTextShowConT arity (K1 i c :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT arity a -> Int -> K1 i c a -> Text #

(TextShow1 f, GTextShowConT One g) => GTextShowConT One (f :.: g) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT One a -> Int -> (f :.: g) a -> Text #

data ShowFunsT arity a where #

A ShowFunsT value either stores nothing (for TextShow) or it stores the two function arguments that show occurrences of the type parameter (for TextShow1). Since: 3.4

Constructors

NoShowFunsT :: ShowFunsT Zero a 
Show1FunsT :: (Int -> a -> Text) -> ([a] -> Text) -> ShowFunsT One a 
Instances
Contravariant (ShowFunsT arity) # 
Instance details

Defined in TextShow.Generic

Methods

contramap :: (a -> b) -> ShowFunsT arity b -> ShowFunsT arity a #

(>$) :: b -> ShowFunsT arity b -> ShowFunsT arity a #

Lazy Text

class GTextShowTL arity f where #

Class of generic representation types that can be converted to a Text. The arity type variable indicates which type class is used. GTextShowTL Zero indicates TextShow behavior, and GTextShowTL One indicates TextShow1 behavior. Since: 3.4

Minimal complete definition

gShowtlPrec

Methods

gShowtlPrec :: ShowFunsTL arity a -> Int -> f a -> Text #

This is used as the default generic implementation of showtlPrec (if the arity is Zero) or liftShowtlPrec (if the arity is One).

Instances
GTextShowTL One (V1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrec :: ShowFunsTL One a -> Int -> V1 a -> Text #

GTextShowTL Zero (V1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrec :: ShowFunsTL Zero a -> Int -> V1 a -> Text #

(Constructor c, GTextShowConTL arity f, IsNullary f) => GTextShowTL arity (C1 c f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrec :: ShowFunsTL arity a -> Int -> C1 c f a -> Text #

(GTextShowTL arity f, GTextShowTL arity g) => GTextShowTL arity (f :+: g) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrec :: ShowFunsTL arity a -> Int -> (f :+: g) a -> Text #

GTextShowTL arity f => GTextShowTL arity (D1 d f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrec :: ShowFunsTL arity a -> Int -> D1 d f a -> Text #

class GTextShowConTL arity f where #

Class of generic representation types for which the ConType has been determined. The arity type variable indicates which type class is used. GTextShowConTL Zero indicates TextShow behavior, and GTextShowConTL One indicates TextShow1 behavior.

Minimal complete definition

gShowtlPrecCon

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL arity a -> Int -> f a -> Text #

Convert value of a specific ConType to a Text with the given precedence.

Instances
GTextShowConTL One Par1 # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL One a -> Int -> Par1 a -> Text #

GTextShowConTL arity (UWord :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL arity a -> Int -> UWord a -> Text #

GTextShowConTL arity (UInt :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL arity a -> Int -> UInt a -> Text #

GTextShowConTL arity (UFloat :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL arity a -> Int -> UFloat a -> Text #

GTextShowConTL arity (UDouble :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL arity a -> Int -> UDouble a -> Text #

GTextShowConTL arity (UChar :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL arity a -> Int -> UChar a -> Text #

GTextShowConTL arity (U1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL arity a -> Int -> U1 a -> Text #

TextShow1 f => GTextShowConTL One (Rec1 f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL One a -> Int -> Rec1 f a -> Text #

(GTextShowConTL arity f, GTextShowConTL arity g) => GTextShowConTL arity (f :*: g) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL arity a -> Int -> (f :*: g) a -> Text #

(Selector s, GTextShowConTL arity f) => GTextShowConTL arity (S1 s f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL arity a -> Int -> S1 s f a -> Text #

TextShow c => GTextShowConTL arity (K1 i c :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL arity a -> Int -> K1 i c a -> Text #

(TextShow1 f, GTextShowConTL One g) => GTextShowConTL One (f :.: g) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL One a -> Int -> (f :.: g) a -> Text #

data ShowFunsTL arity a where #

A ShowFunsTL value either stores nothing (for TextShow) or it stores the two function arguments that show occurrences of the type parameter (for TextShow1). Since: 3.4

Constructors

NoShowFunsTL :: ShowFunsTL Zero a 
Show1FunsTL :: (Int -> a -> Text) -> ([a] -> Text) -> ShowFunsTL One a 
Instances
Contravariant (ShowFunsTL arity) # 
Instance details

Defined in TextShow.Generic

Methods

contramap :: (a -> b) -> ShowFunsTL arity b -> ShowFunsTL arity a #

(>$) :: b -> ShowFunsTL arity b -> ShowFunsTL arity a #

Other internals

class IsNullary f where #

Class of generic representation types that represent a constructor with zero or more fields.

Minimal complete definition

isNullary

Methods

isNullary :: f a -> Bool #

Instances
IsNullary (UWord :: k -> *) # 
Instance details

Defined in TextShow.Generic

Methods

isNullary :: UWord a -> Bool #

IsNullary (UInt :: k -> *) # 
Instance details

Defined in TextShow.Generic

Methods

isNullary :: UInt a -> Bool #

IsNullary (UFloat :: k -> *) # 
Instance details

Defined in TextShow.Generic

Methods

isNullary :: UFloat a -> Bool #

IsNullary (UDouble :: k -> *) # 
Instance details

Defined in TextShow.Generic

Methods

isNullary :: UDouble a -> Bool #

IsNullary (UChar :: k -> *) # 
Instance details

Defined in TextShow.Generic

Methods

isNullary :: UChar a -> Bool #

IsNullary (U1 :: k -> *) # 
Instance details

Defined in TextShow.Generic

Methods

isNullary :: U1 a -> Bool #

IsNullary (Rec1 f :: k -> *) # 
Instance details

Defined in TextShow.Generic

Methods

isNullary :: Rec1 f a -> Bool #

IsNullary (f :*: g :: k -> *) # 
Instance details

Defined in TextShow.Generic

Methods

isNullary :: (f :*: g) a -> Bool #

IsNullary f => IsNullary (S1 s f :: k -> *) # 
Instance details

Defined in TextShow.Generic

Methods

isNullary :: S1 s f a -> Bool #

IsNullary (K1 i c :: k -> *) # 
Instance details

Defined in TextShow.Generic

Methods

isNullary :: K1 i c a -> Bool #

IsNullary (f :.: g :: k -> *) # 
Instance details

Defined in TextShow.Generic

Methods

isNullary :: (f :.: g) a -> Bool #

IsNullary Par1 # 
Instance details

Defined in TextShow.Generic

Methods

isNullary :: Par1 a -> Bool #

data ConType #

Whether a constructor is a record (Rec), a tuple (Tup), is prefix (Pref), or infix (Inf).

Since: 2

Constructors

Rec 
Tup 
Pref 
Inf String 
Instances
Eq ConType # 
Instance details

Defined in TextShow.Generic

Methods

(==) :: ConType -> ConType -> Bool #

(/=) :: ConType -> ConType -> Bool #

Data ConType # 
Instance details

Defined in TextShow.Generic

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ConType -> c ConType #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ConType #

toConstr :: ConType -> Constr #

dataTypeOf :: ConType -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ConType) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ConType) #

gmapT :: (forall b. Data b => b -> b) -> ConType -> ConType #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ConType -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ConType -> r #

gmapQ :: (forall d. Data d => d -> u) -> ConType -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ConType -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ConType -> m ConType #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ConType -> m ConType #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ConType -> m ConType #

Ord ConType # 
Instance details

Defined in TextShow.Generic

Read ConType # 
Instance details

Defined in TextShow.Generic

Show ConType # 
Instance details

Defined in TextShow.Generic

Generic ConType # 
Instance details

Defined in TextShow.Generic

Associated Types

type Rep ConType :: * -> * #

Methods

from :: ConType -> Rep ConType x #

to :: Rep ConType x -> ConType #

Lift ConType # 
Instance details

Defined in TextShow.Generic

Methods

lift :: ConType -> Q Exp #

TextShow ConType # 
Instance details

Defined in TextShow.Generic

type Rep ConType # 
Instance details

Defined in TextShow.Generic

type Rep ConType = D1 (MetaData "ConType" "TextShow.Generic" "text-show-3.7.4-Hysro43h9pL1oxFgxL8lBw" False) ((C1 (MetaCons "Rec" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "Tup" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "Pref" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "Inf" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))))

data Zero #

A type-level indicator that TextShow is being derived generically.

Since: 3.2

Instances
GTextShowTL Zero (V1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrec :: ShowFunsTL Zero a -> Int -> V1 a -> Text #

GTextShowT Zero (V1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrec :: ShowFunsT Zero a -> Int -> V1 a -> Text #

GTextShowB Zero (V1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrec :: ShowFunsB Zero a -> Int -> V1 a -> Builder #

data One #

A type-level indicator that TextShow1 is being derived generically.

Since: 3.2

Instances
GTextShowConTL One Par1 # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL One a -> Int -> Par1 a -> Text #

GTextShowConT One Par1 # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT One a -> Int -> Par1 a -> Text #

GTextShowConB One Par1 # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB One a -> Int -> Par1 a -> Builder #

GTextShowTL One (V1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrec :: ShowFunsTL One a -> Int -> V1 a -> Text #

GTextShowT One (V1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrec :: ShowFunsT One a -> Int -> V1 a -> Text #

GTextShowB One (V1 :: * -> *) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrec :: ShowFunsB One a -> Int -> V1 a -> Builder #

TextShow1 f => GTextShowConTL One (Rec1 f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL One a -> Int -> Rec1 f a -> Text #

TextShow1 f => GTextShowConT One (Rec1 f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT One a -> Int -> Rec1 f a -> Text #

TextShow1 f => GTextShowConB One (Rec1 f) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB One a -> Int -> Rec1 f a -> Builder #

(TextShow1 f, GTextShowConTL One g) => GTextShowConTL One (f :.: g) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtlPrecCon :: ConType -> ShowFunsTL One a -> Int -> (f :.: g) a -> Text #

(TextShow1 f, GTextShowConT One g) => GTextShowConT One (f :.: g) # 
Instance details

Defined in TextShow.Generic

Methods

gShowtPrecCon :: ConType -> ShowFunsT One a -> Int -> (f :.: g) a -> Text #

(TextShow1 f, GTextShowConB One g) => GTextShowConB One (f :.: g) # 
Instance details

Defined in TextShow.Generic

Methods

gShowbPrecCon :: ConType -> ShowFunsB One a -> Int -> (f :.: g) a -> Builder #