-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Proposal #3948: Enhance README Generation #3950
Conversation
- Restructure `introInfo` to focus on `motivation` and `purpose`. - Adjust `whatInfo` to address `background` and `scope`.
Resolved GHC warnings by fixing name shadowing issues and removing redundant bracket. Added new fields into sglPend.
84a79fc
to
3de170f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your actual changes are actually fine - but you are doing them against a bad design... so the right thing to do is to first fix the design, then apply these changes again.
Now, if you want, I would be fine with accepting the code as-is and have you fix the design after. I suspect that that is actually more work!
@@ -52,6 +52,10 @@ type CaseName = String | |||
type ExamplePurpose = String | |||
-- | Description of example | |||
type ExampleDescr = String | |||
-- | Motivation of example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it is good that you are following the established pattern in this code, the problem is that the pattern is wrong... in that GOOL shouldn't know anything at all about 'examples'.
The real problem isn't these types, but ReadMeInfo
which shouldn't be defined inside GOOL
at all!
So I think the first step of the implementation, as a separate PR, would be to first fix this and move this information out of GOOL
.
@@ -150,6 +150,10 @@ genPackage unRepr = do | |||
(foldlSent $ purpose $ codeSpec g) | |||
bckgrnd = show $ sentenceDoc db Implementation OneLine | |||
(foldlSent $ background $ codeSpec g) | |||
mtvtn = show $ sentenceDoc db Implementation OneLine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that same refactor, I think all the stuff that concerns README
generation should be moved out of this file. It could go into Language/Drasil/Code/Imperative/Generator/README
.
@@ -47,6 +47,10 @@ data CodeSpec where | |||
purpose :: Purpose, | |||
-- | Example Background. | |||
background :: Background, | |||
-- | Example Scope. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this information should be in CodeSpec
either. It is fine to have it in SystemInformation
though.
Remove unneed comments.
c576027
to
b82cba4
Compare
I got stuck after representing the fields |
If @balacij can't help you tonight, then I will be at McMaster tomorrow and should be able to help (likely time: early afternoon). |
- Used the generated `sysInfo` lens to access nested fields in `SystemInformation` from `CodeSpec`.
31a4181
to
085e146
Compare
@@ -40,7 +41,7 @@ unmodularDesc = do | |||
implTypeStr Program = "program" | |||
implTypeStr Library = "library" | |||
return $ show $ sentenceDoc (sysinfodb spec) Implementation OneLine $ capSent $ | |||
foldlSent ([S "a", S (implTypeStr (implType g)), S "to"] ++ purpose spec) | |||
foldlSent ([S "a", S (implTypeStr (implType g)), S "to"] ++ codeSpec g ^. sysInfo .purpose) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not need to "double lens" (i.e. .sysInfo .purpose
). If you make the right instance, .purpose
should be enough.
@@ -41,36 +40,3 @@ class AuxiliarySym r where | |||
|
|||
auxHelperDoc :: r (AuxHelper r) -> Doc | |||
auxFromData :: FilePath -> Doc -> r (Auxiliary r) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, this is a nice clean-up!
import Language.Drasil.Code.Imperative.GOOL.ClassInterface (ReadMeInfo(..),PackageSym(..), | ||
AuxiliarySym(..)) | ||
import Language.Drasil.Code.Imperative.GOOL.ClassInterface (PackageSym(..), AuxiliarySym(..)) | ||
import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain to me why all the language renderers need access to ReadMeInfo
?
@@ -5,7 +5,7 @@ module Language.Drasil.Code.Imperative.WriteReadMe ( | |||
import Language.Drasil.Choices (ImplementationType(..)) | |||
import Language.Drasil.Printers (makeMd, introInfo, verInfo, unsupOS, | |||
extLibSec, instDoc, endNote, whatInfo) | |||
import Language.Drasil.Code.Imperative.GOOL.ClassInterface (ReadMeInfo(..)) | |||
import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So much better!
@@ -70,7 +67,9 @@ data CodeSpec where | |||
-- automatically define. | |||
mods :: [Mod], -- medium hack | |||
-- | The database of all chunks used in the problem. | |||
sysinfodb :: ChunkDB | |||
sysinfodb :: ChunkDB, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the aim was to rename this CodeSpec
to OldCodeSpec
and then make CodeSpec
has just 2 fields?
@Xinlu-Y can you please fix the conflict that was recently created? |
- Extracted parts of the original `CodeSpec` into a new` OldCodeSpec` data type. - Used `makeClassyFor` to create accessor functions such as `pNameO`, `authorsO`, `inputsO`, etc., which are now used to access corresponding fields in `OldCodeSpec`. - Generated the `oldCodeSpec` lens, which allows easy access and modification of `OldCodeSpec` fields from a `CodeSpec` instance. - Updated `CodeSpec` to hold both `SystemInformation` and a reference to `OldCodeSpec`. - Modified related functions (e.g., `codeSpec`, `oldcodeSpec`) .
- Introduced `makeClassy` to generate the `HasSystemInformation` type class and associated lenses for the `SystemInformation` data structure. - Updated `CodeSpec` to use the `HasSystemInformation` type class.
@JacquesCarette Dr. Carette, Could you please review the latest changes when you have time? I have addressed the earlier feedback and resolved the conflicts. Thank you! |
This PR implements the design outlined in proposal #3948. The main objective is to ensure that the scope and motivation are included in both the SystemInformation and the generated README files.
Key Updates:
Motivation
anPurpose
are now optional subsections underintroInfo
.background
andscope
are now optional subsections underwhatInfo
.Closes: #3948, #3159, #3248, #3971