I'm dealing with large files of output from Haskell code, most of which is debug info of stuff generating using Haskell's show
.
The important thing about that is that it's a large file of things, nested in either parentheses, or square-brackets.
Something like this:
[(Assign (FormalReturn (Canonical {home = Local, name = "testState"})) (Label 3),ReachingDefs (fromList [(IntermedExpr (Label 22),Just (Label 22)),(FormalReturn (Canonical {home = Local, name = "testState"}),Just (Label 3))])),
(Assign (ActualParam (Label 12)) (Label 12),ReachingDefs (fromList [(IntermedExpr (Label 22),Just (Label 22)),(ActualParam (Label 12),Just (Label 12)),(ActualParam (Label 19),Just (Label 19)),(FormalParam Anything (Label 9),Just (Label 8)),(FormalParam Anything (Label 16),Just (Label 15)),(Ref (Canonical {home = Local, name = "ref"}),Just (Label 16))]))]
The way it's printed, there's no spacing or newlines, so it's pretty much unreadable.
I'm wondering, is there a quick command which will take output like this in a buffer, and space/indent it in an easy-to-read way, based on the hierarchical structure of the parentheses?