| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
ReprTree
Documentation
reprTree :: Data a => a -> Tree String Source #
Get a representation tree of a generic data structure using SYB. Can be used to implement a custom converter to textual representation.
reprTreeString :: Data a => a -> String Source #
A data representation in form of a formatted multiline string, such as the following:
:
- A
| - :
| | - a
| | - b
| | - c
| - 9
- C
| - 3
- B
- D
- :
- :
| - asdf
| - 123
| - ldskfjkl
- :
- f
Which is a result of running the following code:
import Data.Generics (Data, Typeable)
data SomeType =
A [String] Int |
B |
C Int |
D [[String]]
deriving (Typeable, Data)
xxx = A ["a", "b", "c"] 9
: C 3
: B
: D [["asdf", "123", "ldskfjkl"], ["f"]]
: []
main = putStrLn $ reprTreeString xxx