{-# LANGUAGE Safe #-}
module Text.Show.SDP
(
assocsPrec, showsRaw, showsRawLinear
)
where
import Prelude ()
import SDP.SafePrelude
import SDP.Indexed
import GHC.Show ( appPrec )
default ()
assocsPrec :: (Indexed v i e, Show i, Show e) => String -> Int -> v -> ShowS
assocsPrec :: String -> Int -> v -> ShowS
assocsPrec String
name = \ Int
p v
es -> Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
appPrec) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ String -> ShowS
showString String
name
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (i, i) -> ShowS
forall a. Show a => a -> ShowS
shows (v -> (i, i)
forall b i. Bordered b i => b -> (i, i)
bounds v
es)
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
' '
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(i, e)] -> ShowS
forall a. Show a => a -> ShowS
shows (v -> [(i, e)]
forall map key e. Map map key e => map -> [(key, e)]
assocs v
es)
showsRaw :: (Show e) => Int -> [e] -> ShowS
showsRaw :: Int -> [e] -> ShowS
showsRaw Int
_ [] = ShowS
forall a. a -> a
id
showsRaw Int
p (e
x : [e]
xs) = Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
appPrec) ShowS
stream
where
stream :: ShowS
stream = e -> ShowS
forall a. Show a => a -> ShowS
shows e
x ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> ShowS -> ShowS) -> ShowS -> [e] -> ShowS
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (\ e
e ShowS
rest -> Char -> ShowS
showChar Char
' ' ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e -> ShowS
forall a. Show a => a -> ShowS
shows e
e ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShowS
rest) ShowS
forall a. a -> a
id [e]
xs
showsRawLinear :: (Linear l e, Show e) => Int -> l -> ShowS
showsRawLinear :: Int -> l -> ShowS
showsRawLinear Int
p = Int -> [e] -> ShowS
forall e. Show e => Int -> [e] -> ShowS
showsRaw Int
p ([e] -> ShowS) -> (l -> [e]) -> l -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. l -> [e]
forall l e. Linear l e => l -> [e]
listL