JacquesCarette / Drasil

Generate all the things (focusing on research software)
https://jacquescarette.github.io/Drasil
BSD 2-Clause "Simplified" License
142 stars 26 forks source link

How to read the generateCode chart #2921

Closed cd155 closed 2 years ago

cd155 commented 2 years ago

I am not quite sure I understand this chart correctly, so I wonder if someone could explain how to read this chart.

In the brook thesis, this chart shows how the result of genPackage is processed by generateCode to generate files in the user’s system. And arrows represent function calls, and boxes show the type each call results in.

This is the generateCode method. https://github.com/JacquesCarette/Drasil/blob/4d0ba25ce5037a2474cf7b6b28eb5154f7c11a7e/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs#L101-L113

From the beginning, what is Reader DrasilState, and then what is the runReader? It would be great to be guided a little bit on how to read this chart.

JacquesCarette commented 2 years ago

It's a dataflow diagram, with the arrows representing the functions applied and the boxes the types.

The code doesn't quite match, since it's using runState instead of runReader. Also, it calls unReprPack twice (on the same argument) to get at both pieces. The state/reader disconnect happened because this code used to use just reader, but state was added later. It's kind of a good example of why we need Drasil: the documentation became out-of-date with the code!

cd155 commented 2 years ago

Thanks @JacquesCarette , I also add some notes for last week's meeting.

The following is the note for the Jan 21st, 2022 discussion

The workflow for this chart

Notes