{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
#if __GLASGOW_HASKELL__ >= 708
{-# LANGUAGE StandaloneDeriving #-}
#endif
module TextShow.Classes where
#if __GLASGOW_HASKELL__ >= 708
import Data.Data (Typeable)
#endif
import qualified Data.Text as TS (Text, singleton)
import qualified Data.Text.IO as TS (putStrLn, hPutStrLn)
import qualified Data.Text.Lazy as TL (Text, singleton)
import qualified Data.Text.Lazy.IO as TL (putStrLn, hPutStrLn)
import Data.Text.Lazy (toStrict)
import Data.Text.Lazy.Builder (Builder, fromLazyText, fromString,
fromText, singleton, toLazyText)
import GHC.Show (appPrec, appPrec1)
import Prelude ()
import Prelude.Compat
import System.IO (Handle)
import TextShow.Utils (toString, toText)
class TextShow a where
showbPrec :: Int
-> a
-> Builder
showbPrec _ = a -> Builder
forall a. TextShow a => a -> Builder
showb
showb :: a
-> Builder
showb = Int -> a -> Builder
forall a. TextShow a => Int -> a -> Builder
showbPrec 0
showbList :: [a]
-> Builder
showbList = (a -> Builder) -> [a] -> Builder
forall a. (a -> Builder) -> [a] -> Builder
showbListWith a -> Builder
forall a. TextShow a => a -> Builder
showb
showtPrec :: Int
-> a
-> TS.Text
showtPrec p :: Int
p = Text -> Text
toStrict (Text -> Text) -> (a -> Text) -> a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> Text
forall a. TextShow a => Int -> a -> Text
showtlPrec Int
p
showt :: a
-> TS.Text
showt = Int -> a -> Text
forall a. TextShow a => Int -> a -> Text
showtPrec 0
showtList :: [a]
-> TS.Text
showtList = Text -> Text
toStrict (Text -> Text) -> ([a] -> Text) -> [a] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> Text
forall a. TextShow a => [a] -> Text
showtlList
showtlPrec :: Int
-> a
-> TL.Text
showtlPrec p :: Int
p = Builder -> Text
toLazyText (Builder -> Text) -> (a -> Builder) -> a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> Builder
forall a. TextShow a => Int -> a -> Builder
showbPrec Int
p
showtl :: a
-> TL.Text
showtl = Int -> a -> Text
forall a. TextShow a => Int -> a -> Text
showtlPrec 0
showtlList :: [a]
-> TL.Text
showtlList = Builder -> Text
toLazyText (Builder -> Text) -> ([a] -> Builder) -> [a] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> Builder
forall a. TextShow a => [a] -> Builder
showbList
#if __GLASGOW_HASKELL__ >= 708
{-# MINIMAL showbPrec | showb #-}
deriving instance Typeable TextShow
#endif
showbParen :: Bool -> Builder -> Builder
showbParen :: Bool -> Builder -> Builder
showbParen p :: Bool
p builder :: Builder
builder | Bool
p = Char -> Builder
singleton '(' Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
builder Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Char -> Builder
singleton ')'
| Bool
otherwise = Builder
builder
showbCommaSpace :: Builder
showbCommaSpace :: Builder
showbCommaSpace = ", "
showbSpace :: Builder
showbSpace :: Builder
showbSpace = Char -> Builder
singleton ' '
showbListWith :: (a -> Builder) -> [a] -> Builder
showbListWith :: (a -> Builder) -> [a] -> Builder
showbListWith _ [] = "[]"
showbListWith showbx :: a -> Builder
showbx (x :: a
x:xs :: [a]
xs) = Char -> Builder
singleton '[' Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> a -> Builder
showbx a
x Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> [a] -> Builder
go [a]
xs
where
go :: [a] -> Builder
go (y :: a
y:ys :: [a]
ys) = Char -> Builder
singleton ',' Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> a -> Builder
showbx a
y Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> [a] -> Builder
go [a]
ys
go [] = Char -> Builder
singleton ']'
showtParen :: Bool -> TS.Text -> TS.Text
showtParen :: Bool -> Text -> Text
showtParen p :: Bool
p t :: Text
t | Bool
p = Char -> Text
TS.singleton '(' Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
t Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Char -> Text
TS.singleton ')'
| Bool
otherwise = Text
t
showtCommaSpace :: TS.Text
showtCommaSpace :: Text
showtCommaSpace = ", "
showtSpace :: TS.Text
showtSpace :: Text
showtSpace = Char -> Text
TS.singleton ' '
showtListWith :: (a -> TS.Text) -> [a] -> TS.Text
showtListWith :: (a -> Text) -> [a] -> Text
showtListWith _ [] = "[]"
showtListWith showtx :: a -> Text
showtx (x :: a
x:xs :: [a]
xs) = Char -> Text
TS.singleton '[' Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> a -> Text
showtx a
x Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> [a] -> Text
go [a]
xs
where
go :: [a] -> Text
go (y :: a
y:ys :: [a]
ys) = Char -> Text
TS.singleton ',' Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> a -> Text
showtx a
y Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> [a] -> Text
go [a]
ys
go [] = Char -> Text
TS.singleton ']'
showtlParen :: Bool -> TL.Text -> TL.Text
showtlParen :: Bool -> Text -> Text
showtlParen p :: Bool
p t :: Text
t | Bool
p = Char -> Text
TL.singleton '(' Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
t Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Char -> Text
TL.singleton ')'
| Bool
otherwise = Text
t
{-# INLINE showtlParen #-}
showtlCommaSpace :: TL.Text
showtlCommaSpace :: Text
showtlCommaSpace = ", "
showtlSpace :: TL.Text
showtlSpace :: Text
showtlSpace = Char -> Text
TL.singleton ' '
showtlListWith :: (a -> TL.Text) -> [a] -> TL.Text
showtlListWith :: (a -> Text) -> [a] -> Text
showtlListWith _ [] = "[]"
showtlListWith showtlx :: a -> Text
showtlx (x :: a
x:xs :: [a]
xs) = Char -> Text
TL.singleton '[' Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> a -> Text
showtlx a
x Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> [a] -> Text
go [a]
xs
where
go :: [a] -> Text
go (y :: a
y:ys :: [a]
ys) = Char -> Text
TL.singleton ',' Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> a -> Text
showtlx a
y Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> [a] -> Text
go [a]
ys
go [] = Char -> Text
TL.singleton ']'
printT :: TextShow a => a -> IO ()
printT :: a -> IO ()
printT = Text -> IO ()
TS.putStrLn (Text -> IO ()) -> (a -> Text) -> a -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Text
forall a. TextShow a => a -> Text
showt
{-# INLINE printT #-}
printTL :: TextShow a => a -> IO ()
printTL :: a -> IO ()
printTL = Text -> IO ()
TL.putStrLn (Text -> IO ()) -> (a -> Text) -> a -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Text
forall a. TextShow a => a -> Text
showtl
{-# INLINE printTL #-}
hPrintT :: TextShow a => Handle -> a -> IO ()
hPrintT :: Handle -> a -> IO ()
hPrintT h :: Handle
h = Handle -> Text -> IO ()
TS.hPutStrLn Handle
h (Text -> IO ()) -> (a -> Text) -> a -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Text
forall a. TextShow a => a -> Text
showt
{-# INLINE hPrintT #-}
hPrintTL :: TextShow a => Handle -> a -> IO ()
hPrintTL :: Handle -> a -> IO ()
hPrintTL h :: Handle
h = Handle -> Text -> IO ()
TL.hPutStrLn Handle
h (Text -> IO ()) -> (a -> Text) -> a -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Text
forall a. TextShow a => a -> Text
showtl
{-# INLINE hPrintTL #-}
showsPrecToShowbPrec :: (Int -> a -> ShowS) -> Int -> a -> Builder
showsPrecToShowbPrec :: (Int -> a -> ShowS) -> Int -> a -> Builder
showsPrecToShowbPrec sp :: Int -> a -> ShowS
sp p :: Int
p x :: a
x = String -> Builder
fromString (String -> Builder) -> String -> Builder
forall a b. (a -> b) -> a -> b
$ Int -> a -> ShowS
sp Int
p a
x ""
{-# INLINE showsPrecToShowbPrec #-}
showtPrecToShowbPrec :: (Int -> a -> TS.Text) -> Int -> a -> Builder
showtPrecToShowbPrec :: (Int -> a -> Text) -> Int -> a -> Builder
showtPrecToShowbPrec sp :: Int -> a -> Text
sp p :: Int
p = Text -> Builder
fromText (Text -> Builder) -> (a -> Text) -> a -> Builder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> Text
sp Int
p
{-# INLINE showtPrecToShowbPrec #-}
showtlPrecToShowbPrec :: (Int -> a -> TL.Text) -> Int -> a -> Builder
showtlPrecToShowbPrec :: (Int -> a -> Text) -> Int -> a -> Builder
showtlPrecToShowbPrec sp :: Int -> a -> Text
sp p :: Int
p = Text -> Builder
fromLazyText (Text -> Builder) -> (a -> Text) -> a -> Builder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> Text
sp Int
p
{-# INLINE showtlPrecToShowbPrec #-}
showsToShowb :: (a -> ShowS) -> a -> Builder
showsToShowb :: (a -> ShowS) -> a -> Builder
showsToShowb sf :: a -> ShowS
sf x :: a
x = String -> Builder
fromString (String -> Builder) -> String -> Builder
forall a b. (a -> b) -> a -> b
$ a -> ShowS
sf a
x ""
{-# INLINE showsToShowb #-}
showtToShowb :: (a -> TS.Text) -> a -> Builder
showtToShowb :: (a -> Text) -> a -> Builder
showtToShowb sf :: a -> Text
sf = Text -> Builder
fromText (Text -> Builder) -> (a -> Text) -> a -> Builder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Text
sf
{-# INLINE showtToShowb #-}
showtlToShowb :: (a -> TL.Text) -> a -> Builder
showtlToShowb :: (a -> Text) -> a -> Builder
showtlToShowb sf :: a -> Text
sf = Text -> Builder
fromLazyText (Text -> Builder) -> (a -> Text) -> a -> Builder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Text
sf
{-# INLINE showtlToShowb #-}
showbPrecToShowsPrec :: (Int -> a -> Builder) -> Int -> a -> ShowS
showbPrecToShowsPrec :: (Int -> a -> Builder) -> Int -> a -> ShowS
showbPrecToShowsPrec sp :: Int -> a -> Builder
sp p :: Int
p = String -> ShowS
showString (String -> ShowS) -> (a -> String) -> a -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> String
toString (Builder -> String) -> (a -> Builder) -> a -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> Builder
sp Int
p
{-# INLINE showbPrecToShowsPrec #-}
showbPrecToShowtPrec :: (Int -> a -> Builder) -> Int -> a -> TS.Text
showbPrecToShowtPrec :: (Int -> a -> Builder) -> Int -> a -> Text
showbPrecToShowtPrec sp :: Int -> a -> Builder
sp p :: Int
p = Builder -> Text
toText (Builder -> Text) -> (a -> Builder) -> a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> Builder
sp Int
p
{-# INLINE showbPrecToShowtPrec #-}
showbPrecToShowtlPrec :: (Int -> a -> Builder) -> Int -> a -> TL.Text
showbPrecToShowtlPrec :: (Int -> a -> Builder) -> Int -> a -> Text
showbPrecToShowtlPrec sp :: Int -> a -> Builder
sp p :: Int
p = Builder -> Text
toLazyText (Builder -> Text) -> (a -> Builder) -> a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> Builder
sp Int
p
{-# INLINE showbPrecToShowtlPrec #-}
showbToShows :: (a -> Builder) -> a -> ShowS
showbToShows :: (a -> Builder) -> a -> ShowS
showbToShows sf :: a -> Builder
sf = String -> ShowS
showString (String -> ShowS) -> (a -> String) -> a -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> String
toString (Builder -> String) -> (a -> Builder) -> a -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Builder
sf
{-# INLINE showbToShows #-}
showbToShowt :: (a -> Builder) -> a -> TS.Text
showbToShowt :: (a -> Builder) -> a -> Text
showbToShowt sf :: a -> Builder
sf = Builder -> Text
toText (Builder -> Text) -> (a -> Builder) -> a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Builder
sf
{-# INLINE showbToShowt #-}
showbToShowtl :: (a -> Builder) -> a -> TL.Text
showbToShowtl :: (a -> Builder) -> a -> Text
showbToShowtl sf :: a -> Builder
sf = Builder -> Text
toLazyText (Builder -> Text) -> (a -> Builder) -> a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Builder
sf
{-# INLINE showbToShowtl #-}
class TextShow1 f where
liftShowbPrec :: (Int -> a -> Builder) -> ([a] -> Builder)
-> Int -> f a -> Builder
liftShowbList :: (Int -> a -> Builder) -> ([a] -> Builder)
-> [f a] -> Builder
liftShowbList sp :: Int -> a -> Builder
sp sl :: [a] -> Builder
sl = (f a -> Builder) -> [f a] -> Builder
forall a. (a -> Builder) -> [a] -> Builder
showbListWith ((Int -> a -> Builder) -> ([a] -> Builder) -> Int -> f a -> Builder
forall (f :: * -> *) a.
TextShow1 f =>
(Int -> a -> Builder) -> ([a] -> Builder) -> Int -> f a -> Builder
liftShowbPrec Int -> a -> Builder
sp [a] -> Builder
sl 0)
#if __GLASGOW_HASKELL__ >= 708
{-# MINIMAL liftShowbPrec #-}
deriving instance Typeable TextShow1
#endif
showbPrec1 :: (TextShow1 f, TextShow a) => Int -> f a -> Builder
showbPrec1 :: Int -> f a -> Builder
showbPrec1 = (Int -> a -> Builder) -> ([a] -> Builder) -> Int -> f a -> Builder
forall (f :: * -> *) a.
TextShow1 f =>
(Int -> a -> Builder) -> ([a] -> Builder) -> Int -> f a -> Builder
liftShowbPrec Int -> a -> Builder
forall a. TextShow a => Int -> a -> Builder
showbPrec [a] -> Builder
forall a. TextShow a => [a] -> Builder
showbList
{-# INLINE showbPrec1 #-}
showbUnaryWith :: (Int -> a -> Builder) -> Builder -> Int -> a -> Builder
showbUnaryWith :: (Int -> a -> Builder) -> Builder -> Int -> a -> Builder
showbUnaryWith sp :: Int -> a -> Builder
sp nameB :: Builder
nameB p :: Int
p x :: a
x = Bool -> Builder -> Builder
showbParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
appPrec) (Builder -> Builder) -> Builder -> Builder
forall a b. (a -> b) -> a -> b
$
Builder
nameB Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
showbSpace Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> a -> Builder
sp Int
appPrec1 a
x
{-# INLINE showbUnaryWith #-}
liftShowtPrec :: TextShow1 f => (Int -> a -> TS.Text) -> ([a] -> TS.Text)
-> Int -> f a -> TS.Text
liftShowtPrec :: (Int -> a -> Text) -> ([a] -> Text) -> Int -> f a -> Text
liftShowtPrec sp :: Int -> a -> Text
sp sl :: [a] -> Text
sl = (Int -> f a -> Builder) -> Int -> f a -> Text
forall a. (Int -> a -> Builder) -> Int -> a -> Text
showbPrecToShowtPrec ((Int -> f a -> Builder) -> Int -> f a -> Text)
-> (Int -> f a -> Builder) -> Int -> f a -> Text
forall a b. (a -> b) -> a -> b
$ (Int -> a -> Builder) -> ([a] -> Builder) -> Int -> f a -> Builder
forall (f :: * -> *) a.
TextShow1 f =>
(Int -> a -> Builder) -> ([a] -> Builder) -> Int -> f a -> Builder
liftShowbPrec ((Int -> a -> Text) -> Int -> a -> Builder
forall a. (Int -> a -> Text) -> Int -> a -> Builder
showtPrecToShowbPrec Int -> a -> Text
sp) (([a] -> Text) -> [a] -> Builder
forall a. (a -> Text) -> a -> Builder
showtToShowb [a] -> Text
sl)
liftShowtlPrec :: TextShow1 f => (Int -> a -> TL.Text) -> ([a] -> TL.Text)
-> Int -> f a -> TL.Text
liftShowtlPrec :: (Int -> a -> Text) -> ([a] -> Text) -> Int -> f a -> Text
liftShowtlPrec sp :: Int -> a -> Text
sp sl :: [a] -> Text
sl = (Int -> f a -> Builder) -> Int -> f a -> Text
forall a. (Int -> a -> Builder) -> Int -> a -> Text
showbPrecToShowtlPrec ((Int -> f a -> Builder) -> Int -> f a -> Text)
-> (Int -> f a -> Builder) -> Int -> f a -> Text
forall a b. (a -> b) -> a -> b
$ (Int -> a -> Builder) -> ([a] -> Builder) -> Int -> f a -> Builder
forall (f :: * -> *) a.
TextShow1 f =>
(Int -> a -> Builder) -> ([a] -> Builder) -> Int -> f a -> Builder
liftShowbPrec ((Int -> a -> Text) -> Int -> a -> Builder
forall a. (Int -> a -> Text) -> Int -> a -> Builder
showtlPrecToShowbPrec Int -> a -> Text
sp) (([a] -> Text) -> [a] -> Builder
forall a. (a -> Text) -> a -> Builder
showtlToShowb [a] -> Text
sl)
class TextShow2 f where
liftShowbPrec2 :: (Int -> a -> Builder) -> ([a] -> Builder)
-> (Int -> b -> Builder) -> ([b] -> Builder)
-> Int -> f a b -> Builder
liftShowbList2 :: (Int -> a -> Builder) -> ([a] -> Builder)
-> (Int -> b -> Builder) -> ([b] -> Builder)
-> [f a b] -> Builder
liftShowbList2 sp1 :: Int -> a -> Builder
sp1 sl1 :: [a] -> Builder
sl1 sp2 :: Int -> b -> Builder
sp2 sl2 :: [b] -> Builder
sl2 =
(f a b -> Builder) -> [f a b] -> Builder
forall a. (a -> Builder) -> [a] -> Builder
showbListWith ((Int -> a -> Builder)
-> ([a] -> Builder)
-> (Int -> b -> Builder)
-> ([b] -> Builder)
-> Int
-> f a b
-> Builder
forall (f :: * -> * -> *) a b.
TextShow2 f =>
(Int -> a -> Builder)
-> ([a] -> Builder)
-> (Int -> b -> Builder)
-> ([b] -> Builder)
-> Int
-> f a b
-> Builder
liftShowbPrec2 Int -> a -> Builder
sp1 [a] -> Builder
sl1 Int -> b -> Builder
sp2 [b] -> Builder
sl2 0)
#if __GLASGOW_HASKELL__ >= 708
{-# MINIMAL liftShowbPrec2 #-}
deriving instance Typeable TextShow2
#endif
showbPrec2 :: (TextShow2 f, TextShow a, TextShow b) => Int -> f a b -> Builder
showbPrec2 :: Int -> f a b -> Builder
showbPrec2 = (Int -> a -> Builder)
-> ([a] -> Builder)
-> (Int -> b -> Builder)
-> ([b] -> Builder)
-> Int
-> f a b
-> Builder
forall (f :: * -> * -> *) a b.
TextShow2 f =>
(Int -> a -> Builder)
-> ([a] -> Builder)
-> (Int -> b -> Builder)
-> ([b] -> Builder)
-> Int
-> f a b
-> Builder
liftShowbPrec2 Int -> a -> Builder
forall a. TextShow a => Int -> a -> Builder
showbPrec [a] -> Builder
forall a. TextShow a => [a] -> Builder
showbList Int -> b -> Builder
forall a. TextShow a => Int -> a -> Builder
showbPrec [b] -> Builder
forall a. TextShow a => [a] -> Builder
showbList
{-# INLINE showbPrec2 #-}
showbBinaryWith :: (Int -> a -> Builder) -> (Int -> b -> Builder) ->
Builder -> Int -> a -> b -> Builder
showbBinaryWith :: (Int -> a -> Builder)
-> (Int -> b -> Builder) -> Builder -> Int -> a -> b -> Builder
showbBinaryWith sp1 :: Int -> a -> Builder
sp1 sp2 :: Int -> b -> Builder
sp2 nameB :: Builder
nameB p :: Int
p x :: a
x y :: b
y = Bool -> Builder -> Builder
showbParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
appPrec) (Builder -> Builder) -> Builder -> Builder
forall a b. (a -> b) -> a -> b
$ Builder
nameB
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
showbSpace Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> a -> Builder
sp1 Int
appPrec1 a
x
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
showbSpace Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> b -> Builder
sp2 Int
appPrec1 b
y
{-# INLINE showbBinaryWith #-}
liftShowtPrec2 :: TextShow2 f
=> (Int -> a -> TS.Text) -> ([a] -> TS.Text)
-> (Int -> b -> TS.Text) -> ([b] -> TS.Text)
-> Int -> f a b -> TS.Text
liftShowtPrec2 :: (Int -> a -> Text)
-> ([a] -> Text)
-> (Int -> b -> Text)
-> ([b] -> Text)
-> Int
-> f a b
-> Text
liftShowtPrec2 sp1 :: Int -> a -> Text
sp1 sl1 :: [a] -> Text
sl1 sp2 :: Int -> b -> Text
sp2 sl2 :: [b] -> Text
sl2 = (Int -> f a b -> Builder) -> Int -> f a b -> Text
forall a. (Int -> a -> Builder) -> Int -> a -> Text
showbPrecToShowtPrec ((Int -> f a b -> Builder) -> Int -> f a b -> Text)
-> (Int -> f a b -> Builder) -> Int -> f a b -> Text
forall a b. (a -> b) -> a -> b
$
(Int -> a -> Builder)
-> ([a] -> Builder)
-> (Int -> b -> Builder)
-> ([b] -> Builder)
-> Int
-> f a b
-> Builder
forall (f :: * -> * -> *) a b.
TextShow2 f =>
(Int -> a -> Builder)
-> ([a] -> Builder)
-> (Int -> b -> Builder)
-> ([b] -> Builder)
-> Int
-> f a b
-> Builder
liftShowbPrec2 ((Int -> a -> Text) -> Int -> a -> Builder
forall a. (Int -> a -> Text) -> Int -> a -> Builder
showtPrecToShowbPrec Int -> a -> Text
sp1) (([a] -> Text) -> [a] -> Builder
forall a. (a -> Text) -> a -> Builder
showtToShowb [a] -> Text
sl1)
((Int -> b -> Text) -> Int -> b -> Builder
forall a. (Int -> a -> Text) -> Int -> a -> Builder
showtPrecToShowbPrec Int -> b -> Text
sp2) (([b] -> Text) -> [b] -> Builder
forall a. (a -> Text) -> a -> Builder
showtToShowb [b] -> Text
sl2)
liftShowtlPrec2 :: TextShow2 f
=> (Int -> a -> TL.Text) -> ([a] -> TL.Text)
-> (Int -> b -> TL.Text) -> ([b] -> TL.Text)
-> Int -> f a b -> TL.Text
liftShowtlPrec2 :: (Int -> a -> Text)
-> ([a] -> Text)
-> (Int -> b -> Text)
-> ([b] -> Text)
-> Int
-> f a b
-> Text
liftShowtlPrec2 sp1 :: Int -> a -> Text
sp1 sl1 :: [a] -> Text
sl1 sp2 :: Int -> b -> Text
sp2 sl2 :: [b] -> Text
sl2 = (Int -> f a b -> Builder) -> Int -> f a b -> Text
forall a. (Int -> a -> Builder) -> Int -> a -> Text
showbPrecToShowtlPrec ((Int -> f a b -> Builder) -> Int -> f a b -> Text)
-> (Int -> f a b -> Builder) -> Int -> f a b -> Text
forall a b. (a -> b) -> a -> b
$
(Int -> a -> Builder)
-> ([a] -> Builder)
-> (Int -> b -> Builder)
-> ([b] -> Builder)
-> Int
-> f a b
-> Builder
forall (f :: * -> * -> *) a b.
TextShow2 f =>
(Int -> a -> Builder)
-> ([a] -> Builder)
-> (Int -> b -> Builder)
-> ([b] -> Builder)
-> Int
-> f a b
-> Builder
liftShowbPrec2 ((Int -> a -> Text) -> Int -> a -> Builder
forall a. (Int -> a -> Text) -> Int -> a -> Builder
showtlPrecToShowbPrec Int -> a -> Text
sp1) (([a] -> Text) -> [a] -> Builder
forall a. (a -> Text) -> a -> Builder
showtlToShowb [a] -> Text
sl1)
((Int -> b -> Text) -> Int -> b -> Builder
forall a. (Int -> a -> Text) -> Int -> a -> Builder
showtlPrecToShowbPrec Int -> b -> Text
sp2) (([b] -> Text) -> [b] -> Builder
forall a. (a -> Text) -> a -> Builder
showtlToShowb [b] -> Text
sl2)