-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

-- The benefit of having our own deeply-embedded type for pretty
-- printing things would be so we can render it in different backend
-- formats later (text, LaTeX, HTML, ...) so at some point it may be
-- worth doing it.  The idea would be to mostly replicate the
-- interface of the pretty-printing library currently being used, so
-- that a lot of code could just be kept unchanged.

-- |
-- Module      :  Disco.Report
-- Copyright   :  disco team and contributors
-- Maintainer  :  byorgey@gmail.com
--
-- SPDX-License-Identifier: BSD-3-Clause
--
-- XXX
module Disco.Report where

import Data.List (intersperse)

data Report
  = RTxt String
  | RSeq [Report]
  | RVSeq [Report]
  | RList [Report]
  | RNest Report
  deriving (Int -> Report -> ShowS
[Report] -> ShowS
Report -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Report] -> ShowS
$cshowList :: [Report] -> ShowS
show :: Report -> String
$cshow :: Report -> String
showsPrec :: Int -> Report -> ShowS
$cshowsPrec :: Int -> Report -> ShowS
Show)

text :: String -> Report
text :: String -> Report
text = String -> Report
RTxt

hcat :: [Report] -> Report
hcat :: [Report] -> Report
hcat = [Report] -> Report
RSeq

hsep :: [Report] -> Report
hsep :: [Report] -> Report
hsep = [Report] -> Report
hcat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> [a]
intersperse (String -> Report
text String
" ")

vcat :: [Report] -> Report
vcat :: [Report] -> Report
vcat = [Report] -> Report
RVSeq

vsep :: [Report] -> Report
vsep :: [Report] -> Report
vsep = [Report] -> Report
vcat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> [a]
intersperse (String -> Report
text String
"")

list :: [Report] -> Report
list :: [Report] -> Report
list = [Report] -> Report
RList

nest :: Report -> Report
nest :: Report -> Report
nest = Report -> Report
RNest

------------------------------------------------------------