module Data.Array.Parallel.Pretty
( module Text.PrettyPrint
, PprPhysical(..)
, PprVirtual (..))
where
import Text.PrettyPrint
import qualified Data.Vector as V
import Data.Vector (Vector)
class PprPhysical a where
pprp :: a -> Doc
instance PprPhysical Bool where
pprp = text . show
instance PprPhysical Int where
pprp = text . show
instance PprPhysical Double where
pprp = text . show
class PprVirtual a where
pprv :: a -> Doc
instance PprVirtual Bool where
pprv = text . show
instance PprVirtual Int where
pprv = text . show
instance PprVirtual Double where
pprv = text . show
instance (PprPhysical a, PprPhysical b)
=> PprPhysical (a, b) where
pprp (x, y)
= vcat
[ text "Tuple2"
, nest 4 $ pprp x
, nest 4 $ pprp y]
instance PprPhysical a
=> PprPhysical (Vector a) where
pprp vec
= brackets
$ hcat
$ punctuate (text ", ")
$ V.toList $ V.map pprp vec