r/functionalprogramming • u/_lazyLambda • Dec 03 '25
Question Control Flow Graphs
For context I am trying to write more about why functional programming is so awesome and as i am a very visual person I become interested in diagramming out the possible behaviors of my code.
I have learned today that this is formally called a control flow graph, and that they are important to understanding and building compilers which makes sense seeing as my input to Ghc for instance is just a control flow graph, with types.
It feels like such an important idea however theres so little online discussion about control flow diagrams and how to write great programs. Is there maybe a better name for this that is analogous? Or why is this not talked about in every intro to programming or even intro to FP?
My apologies if this is too vague a question. I will edit my question if I understand it better with time.
View all comments
Show parent comment
3
u/_lazyLambda Dec 04 '25
True, I wonder if it would be useful to have a way to visualize the CFG and in that visual, you can expand or minimize scopes
Input -> f -> Output Input -> f { g , h , j } -> Output ...
Ultimately just for the sake of explaining code to oneself or others. Even if its just as a way to get strong fundamentals seeing as every program fits this shape