-
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
Removing asVC' hack with replacement QuantityDicts #2952
Removing asVC' hack with replacement QuantityDicts #2952
Conversation
@@ -185,7 +189,7 @@ interpY = funcDef "interpY" | |||
] | |||
|
|||
interpZ :: Func | |||
interpZ = funcDef "interpZ" | |||
interpZ = funcDef (showUID U.interpZ) |
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.
To continue the discussion we had on Teams here a bit, showUID
(something that shouldn't really exist outside of ChunkDB debugging code) usage here is only desired because we want it to rely on (& align with) the information from the newly created QuantityDicts (I guess a more appropriate way to get the function name would be a "showSymbol"-like function for the implementation-stage name of the interpZ QuantityDict), but I think this would be best "cleaned up" if/when we place Func
s inside of the ChunkDBs. As they are right now, we aren't able to place them in the ChunkDBs because (a) they don't have UIDs, and (b) the ChunkDBs would require a bit more effort for us to be able to place Func
s inside of ChunkDB
s so that we can still link the QuantityDict and the Func (maybe #2873).
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.
Using a hacked up showSymbol
-like function would be quite a bit superior to using showUID
. It would at least be pulling from the 'right' bucket of information.
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 agree, that makes sense.
Regarding the type of the symbol, should it really be a String? Specifically, is there any worth in changing it to the "Implementation-level Symbol"?
If we choose String, I think we have ~2 options:
- figure out a way to convert the "Implementation-level Symbol" into a Doc/Text (this should already exist somewhere I believe), and then into extract it into a String, or
- roll our own "Symbol -> String" function (of course, this creates potential room for misalignment with the existing Symbol -> Doc/Text functions)
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.
No, it doesn't have to be String. Thinking about it, it should indeed be implementation-level symbol. Well spotted!
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.
Thank you. That sounds good. In that case, I think it would be out of scope for this PR; continuing on #2959.
@@ -159,7 +163,7 @@ extractColumnCT = funcDef "extractColumn" "Extracts a column from a 2D matrix" | |||
] | |||
|
|||
interpY :: Func | |||
interpY = funcDef "interpY" | |||
interpY = funcDef (showUID U.interpY) |
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.
Surely there's another field than UID
in U.interpY
which also have value "interpY" that could be used? Of this whole change, this is the one bit that sticks out as a hack, all the rest seems great.
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.
@JacquesCarette @balacij I have made the requested changes in 17d3425.
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 have - but the changes are too "brute force". You most definitely should not be importing HughesPJ into any example! The right thing to do is to write an appropriate function (that does what you just coded up) somewhere in an appropriate Drasil package, and then call it here. Figuring out the right signature is going to be a fun design problem.
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.
@JacquesCarette would a showSymb-like function be helpful in Drasil? (Placed into Drasil/Symbol/Helpers.hs)
showSymb :: Symbol -> String
showSymb a = render $ symbolDoc a
This would allow for the removal of HughesPJ from the example
interpZ :: Func
interpZ = funcDef (showSymb $ symbol U.interpZ Implementation)
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.
Yes, such a function would be good. Probably belongs in drasil-printers. I'd be tempted to put it under the ASCII printer.
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.
@JacquesCarette I had just edited the above comment to suggest placing it in Drasil/Symbol/Helpers.hs, but I will look into placing it into drasil-printers. The latter does sound more appropriate.
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.
@JacquesCarette The requested change to add a new function has been applied in the latest commit. The PR is updated.
@@ -185,7 +189,7 @@ interpY = funcDef "interpY" | |||
] | |||
|
|||
interpZ :: Func | |||
interpZ = funcDef "interpZ" | |||
interpZ = funcDef (showUID U.interpZ) |
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.
Using a hacked up showSymbol
-like function would be quite a bit superior to using showUID
. It would at least be pulling from the 'right' bucket of information.
@@ -163,7 +162,7 @@ extractColumnCT = funcDef "extractColumn" "Extracts a column from a 2D matrix" | |||
] | |||
|
|||
interpY :: Func | |||
interpY = funcDef (showUID U.interpY) | |||
interpY = funcDef (showSymb $ symbol U.interpY Implementation) |
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.
These details should not be in GlassBR. The function that does
foo :: HasSymbol x => x -> String
foo x = showSymb $ symbol x Implementation
should be in drasil-printers and then called from here.
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.
@JacquesCarette The requested change is added in 243618f
interpZ :: Func | ||
interpZ = funcDef (showUID U.interpZ) | ||
interpZ = funcDef (showSymb $ symbol U.interpZ Implementation) |
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.
and here
@@ -180,3 +180,7 @@ fenceDocR Paren = text ")" | |||
fenceDocR Curly = text "}" | |||
fenceDocR Norm = text "\\|" | |||
fenceDocR Abs = text "|" | |||
|
|||
-- | Helper for printing Symbols | |||
showSymb :: Symbol -> String |
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.
good start, but this only does 1/2 the job
For issue #1166