{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module TextShow.Data.Functor.Compose () where
import Data.Functor.Compose (Compose(..))
import TextShow.Classes (TextShow(..), TextShow1(..), showbPrec1, showbUnaryWith)
instance (TextShow1 f, TextShow1 g, TextShow a) => TextShow (Compose f g a) where
showbPrec :: Int -> Compose f g a -> Builder
showbPrec = forall (f :: * -> *) a.
(TextShow1 f, TextShow a) =>
Int -> f a -> Builder
showbPrec1
{-# INLINE showbPrec #-}
instance (TextShow1 f, TextShow1 g) => TextShow1 (Compose f g) where
liftShowbPrec :: forall a.
(Int -> a -> Builder)
-> ([a] -> Builder) -> Int -> Compose f g a -> Builder
liftShowbPrec Int -> a -> Builder
sp [a] -> Builder
sl Int
p (Compose f (g a)
x) =
forall a. (Int -> a -> Builder) -> Builder -> Int -> a -> Builder
showbUnaryWith (forall (f :: * -> *) a.
TextShow1 f =>
(Int -> a -> Builder) -> ([a] -> Builder) -> Int -> f a -> Builder
liftShowbPrec (forall (f :: * -> *) a.
TextShow1 f =>
(Int -> a -> Builder) -> ([a] -> Builder) -> Int -> f a -> Builder
liftShowbPrec Int -> a -> Builder
sp [a] -> Builder
sl)
(forall (f :: * -> *) a.
TextShow1 f =>
(Int -> a -> Builder) -> ([a] -> Builder) -> [f a] -> Builder
liftShowbList Int -> a -> Builder
sp [a] -> Builder
sl))
Builder
"Compose" Int
p f (g a)
x