{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module TextShow.Control.Applicative.Trans () where
import Control.Applicative.Backwards (Backwards(..))
import Control.Applicative.Lift (Lift(..))
import TextShow (TextShow(..), TextShow1(..),
showbPrec1, showbUnaryWith)
import TextShow.Utils (liftShowbUnaryWith)
instance (TextShow1 f, TextShow a) => TextShow (Backwards f a) where
showbPrec :: Int -> Backwards f a -> Builder
showbPrec = forall (f :: * -> *) a.
(TextShow1 f, TextShow a) =>
Int -> f a -> Builder
showbPrec1
{-# INLINE showbPrec #-}
instance TextShow1 f => TextShow1 (Backwards f) where
liftShowbPrec :: forall a.
(Int -> a -> Builder)
-> ([a] -> Builder) -> Int -> Backwards f a -> Builder
liftShowbPrec Int -> a -> Builder
sp [a] -> Builder
sl Int
p (Backwards f a
x) = forall (m :: * -> *) a.
TextShow1 m =>
(Int -> a -> Builder)
-> ([a] -> Builder) -> Builder -> Int -> m a -> Builder
liftShowbUnaryWith Int -> a -> Builder
sp [a] -> Builder
sl Builder
"Backwards" Int
p f a
x
{-# INLINE liftShowbPrec #-}
instance (TextShow1 f, TextShow a) => TextShow (Lift f a) where
showbPrec :: Int -> Lift f a -> Builder
showbPrec = forall (f :: * -> *) a.
(TextShow1 f, TextShow a) =>
Int -> f a -> Builder
showbPrec1
{-# INLINE showbPrec #-}
instance TextShow1 f => TextShow1 (Lift f) where
liftShowbPrec :: forall a.
(Int -> a -> Builder)
-> ([a] -> Builder) -> Int -> Lift f a -> Builder
liftShowbPrec Int -> a -> Builder
sp [a] -> Builder
_ Int
p (Pure a
x) = forall a. (Int -> a -> Builder) -> Builder -> Int -> a -> Builder
showbUnaryWith Int -> a -> Builder
sp Builder
"Pure" Int
p a
x
liftShowbPrec Int -> a -> Builder
sp [a] -> Builder
sl Int
p (Other f a
y) = 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 Int -> a -> Builder
sp [a] -> Builder
sl) Builder
"Other" Int
p f a
y
{-# INLINE liftShowbPrec #-}