module TextShow.Control.Applicative.Trans (
liftShowbBackwardsPrec
, liftShowbLiftPrec
) where
import Control.Applicative.Backwards (Backwards(..))
import Control.Applicative.Lift (Lift(..))
import TextShow (TextShow(..), TextShow1(..),
Builder, showbPrec1, showbUnaryWith)
#include "inline.h"
liftShowbBackwardsPrec :: TextShow1 f
=> (Int -> a -> Builder) -> ([a] -> Builder)
-> Int -> Backwards f a -> Builder
liftShowbBackwardsPrec sp sl p (Backwards x)
= showbUnaryWith (liftShowbPrec sp sl) "Backwards" p x
liftShowbLiftPrec :: TextShow1 f
=> (Int -> a -> Builder) -> ([a] -> Builder)
-> Int -> Lift f a -> Builder
liftShowbLiftPrec sp _ p (Pure x) = showbUnaryWith sp "Pure" p x
liftShowbLiftPrec sp sl p (Other y) = showbUnaryWith (liftShowbPrec sp sl) "Other" p y
instance (TextShow1 f, TextShow a) => TextShow (Backwards f a) where
showbPrec = showbPrec1
INLINE_INST_FUN(showbPrec)
instance TextShow1 f => TextShow1 (Backwards f) where
liftShowbPrec = liftShowbBackwardsPrec
INLINE_INST_FUN(liftShowbPrec)
instance (TextShow1 f, TextShow a) => TextShow (Lift f a) where
showbPrec = showbPrec1
INLINE_INST_FUN(showbPrec)
instance TextShow1 f => TextShow1 (Lift f) where
liftShowbPrec = liftShowbLiftPrec
INLINE_INST_FUN(liftShowbPrec)