-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Print Data instances as a nested tree
--   
--   Provides functionality similar to that of the <a>Show</a> class:
--   Taking some arbitrary value and returning a String.
--   
--   <ul>
--   <li>Output is not intended to be valid haskell.</li>
--   <li>Requires a <a>Data.Data.Data</a> instance instead of a
--   <a>Text.Show</a> one.</li>
--   <li>Output, if large, is often easier to parse than <a>show</a> output
--   due to the formatting as a nested tree.</li>
--   <li>The user can adapt the behaviour at runtime using custom layouting
--   expressed via syb-style extension.</li>
--   </ul>
@package data-tree-print
@version 0.1.0.2

module DataTreePrint

-- | The "simple" printer does not try to fit more than one node into the
--   same line, even if it would fit.
simplePrintTree :: Data a => a -> Doc

-- | Allows to specialize the transformation for specific types. Use
--   <tt>syb</tt>'s <a>extQ</a> function(s). See the source of
--   <a>defaultLayouterF</a> for an example of how to do this.
simplePrintTreeWithCustom :: Data a => ToDocF -> a -> Doc

-- | Somewhat more intelligent printer that tries to fit multiple nodes
--   into the same line there is space given the specified number of total
--   columns. For example, `(1,2,3)` will be printed as "(,,) (1) (2) (3)"
--   instead of "(,,)n 1n 2n 3". Parentheses are added in these cases to
--   prevent syntactic ambiguities.
printTree :: forall a. Data a => Int -> a -> Doc
printTreeWithCustom :: Data a => Int -> LayouterF -> a -> Doc
showTree :: Data a => a -> String
showTreeWithCustom :: Data a => LayouterF -> a -> String

-- | This newtype is necessary so <a>fix</a> can be used in combination
--   with the constrained forall-quantification.
newtype DataToLayouter
DataToLayouter :: (forall a. Data a => a -> NodeLayouter) -> DataToLayouter
[runDataToLayouter] :: DataToLayouter -> forall a. Data a => a -> NodeLayouter
type LayouterF = DataToLayouter -> DataToLayouter
data NodeLayouter
NodeLayouter :: Int -> Bool -> (Either Bool Int -> Doc) -> NodeLayouter

-- | the length of this node, if printed on a single line
[_lay_llength] :: NodeLayouter -> Int
[_lay_needsParens] :: NodeLayouter -> Bool

-- | Left: one-line output, the boolean indicates if parentheses are
--   advisable given the context. (They can be omitted in cases like when
--   there is only one constructor). Right: The Int is the remaining
--   vertical space left for this node.
[_lay_func] :: NodeLayouter -> Either Bool Int -> Doc
defaultLayouterF :: LayouterF
