{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module TextShow.Control.Applicative () where
import Control.Applicative (Const(..), ZipList)
import Data.Text.Lazy.Builder (Builder)
import TextShow.Classes (TextShow(..), TextShow1(..),
TextShow2(..), showbUnaryWith)
import TextShow.Data.List ()
import TextShow.TH.Internal (deriveTextShow, deriveTextShow1)
instance TextShow a => TextShow (Const a b) where
showbPrec :: Int -> Const a b -> Builder
showbPrec = (Int -> a -> Builder) -> Int -> Const a b -> Builder
forall {k} a (b :: k).
(Int -> a -> Builder) -> Int -> Const a b -> Builder
liftShowbConstPrec Int -> a -> Builder
forall a. TextShow a => Int -> a -> Builder
showbPrec
instance TextShow a => TextShow1 (Const a) where
liftShowbPrec :: forall a.
(Int -> a -> Builder)
-> ([a] -> Builder) -> Int -> Const a a -> Builder
liftShowbPrec Int -> a -> Builder
_ [a] -> Builder
_ = (Int -> a -> Builder) -> Int -> Const a a -> Builder
forall {k} a (b :: k).
(Int -> a -> Builder) -> Int -> Const a b -> Builder
liftShowbConstPrec Int -> a -> Builder
forall a. TextShow a => Int -> a -> Builder
showbPrec
instance TextShow2 Const where
liftShowbPrec2 :: forall a b.
(Int -> a -> Builder)
-> ([a] -> Builder)
-> (Int -> b -> Builder)
-> ([b] -> Builder)
-> Int
-> Const a b
-> Builder
liftShowbPrec2 Int -> a -> Builder
sp [a] -> Builder
_ Int -> b -> Builder
_ [b] -> Builder
_ = (Int -> a -> Builder) -> Int -> Const a b -> Builder
forall {k} a (b :: k).
(Int -> a -> Builder) -> Int -> Const a b -> Builder
liftShowbConstPrec Int -> a -> Builder
sp
liftShowbConstPrec :: (Int -> a -> Builder) -> Int -> Const a b -> Builder
liftShowbConstPrec :: forall {k} a (b :: k).
(Int -> a -> Builder) -> Int -> Const a b -> Builder
liftShowbConstPrec Int -> a -> Builder
sp Int
p (Const a
x) = (Int -> a -> Builder) -> Builder -> Int -> a -> Builder
forall a. (Int -> a -> Builder) -> Builder -> Int -> a -> Builder
showbUnaryWith Int -> a -> Builder
sp Builder
"Const" Int
p a
x
{-# INLINE liftShowbConstPrec #-}
$(deriveTextShow ''ZipList)
$(deriveTextShow1 ''ZipList)