Skip to content

Make output less vertical #43

@buggymcbugfix

Description

@buggymcbugfix

Thank you for this awesome library. I was trying to make the following ugly debug output (for granule in case you were wondering) more palatable.

AST [] [Def ((3,1),(5,30)) (Id "fact'" "fact'") [Equation ((4,1),(4,13)) () [PBox ((4,7),(4,9)) () (PCon
str ((4,8),(4,8)) () (Id "Z" "Z") [])] (Val ((4,13),(4,13)) () (NumInt 1)),Equation ((5,1),(5,30)) () [P
Box ((5,7),(5,11)) () (PConstr ((5,8),(5,10)) () (Id "S" "S") [PVar ((5,10),(5,10)) () (Id "m" "m_1")])]
 (Binop ((5,30),(5,30)) () "*" (App ((5,15),(5,27)) () (Val ((5,15),(5,15)) () (Var () (Id "natToInt" "n
atToInt"))) (App ((5,25),(5,27)) () (Val ((5,25),(5,25)) () (Constr () (Id "S" "S") [])) (Val ((5,27),(5
,27)) () (Var () (Id "m" "m_1"))))) (App ((5,32),(5,40)) () (Val ((5,32),(5,32)) () (Var () (Id "fact'"
"fact'"))) (Val ((5,38),(5,40)) () (Promote () (Val ((5,39),(5,39)) () (Var () (Id "m" "m_1")))))))] (Fo
rall ((3,9),(3,26)) [((Id "n" "n_0"),KPromote (TyCon (Id "Nat" "Nat")))] (FunTy (Box (CInterval {lowerBo
und = CNat 1, upperBound = CVar (Id "n" "n_0")}) (TyApp (TyCon (Id "N" "N")) (TyVar (Id "n" "n_0")))) (T
yCon (Id "Int" "Int"))))]

Yikes! However, pretty-simple is a bit overzealous and makes it too pretty:

AST []
    [ Def
        (
            ( 3
            , 1
            )
        ,
            ( 5
            , 30
            )
        ) ( Id "fact'" "fact'" )
        [ Equation
            (
                ( 4
                , 1
                )
            ,
                ( 4
                , 13
                )
            ) ()
            [ PBox
                (
                    ( 4
                    , 7
                    )
                ,
                    ( 4
                    , 9
                    )
                ) ()
                ( PConstr
                    (
                        ( 4
                        , 8
                        )
                    ,
                        ( 4
                        , 8
                        )
                    ) () ( Id "Z" "Z" ) []
                )
            ]
            ( Val
                (
                    ( 4
                    , 13
                    )
                ,
                    ( 4
                    , 13
                    )
                ) () ( NumInt 1 )
            )
        , Equation
            (
                ( 5
                , 1
                )
            ,
                ( 5
                , 30
                )
            ) ()
            [ PBox
                (
                    ( 5
                    , 7
                    )
                ,
                    ( 5
                    , 11
                    )
                ) ()
                ( PConstr
                    (
                        ( 5
                        , 8
                        )
                    ,
                        ( 5
                        , 10
                        )
                    ) () ( Id "S" "S" )
                    [ PVar
                        (
                            ( 5
                            , 10
                            )
                        ,
                            ( 5
                            , 10
                            )
                        ) () ( Id "m" "m_1" )
[etc.]

Is there an easy way to make things less vertical?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions