Closed cd155 closed 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!
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
Reader
: this is a data structure that will be processed in reader monadReader
Constructor takes Drasil state, and (packRepr (Package packRepr)
Reader
is packed, so we need to instantiate it (unReprPack
), then it will give you a PackData
PackData
split into the program(ProgData
) and various auxiliary filesProgData
)[FileData]
) and right files([AuxData]
) will assemble again, to generate all the code, including code, headers files, make filesDoc
is the pretty printed version of each artifactFilePath
is the pass to where the file will beNotes
runState (genPackage unReprProg) g
takes a package representation, and give you the data structure, PackData
packRepr
is a type variable,(packRepr (Package packRepr) -> PackData)
removes the polymorphism of packRepr
, and create useful data (PackData
)
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 bygenerateCode
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-L113From 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.