-
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
Sentence vs concept-level combinators #2399
Comments
My first idea to go about completing this was to import qualified |
We could also split up Utils.Drasil into two separate files (the concepts go with the general file while the sentence combinators get their own separate imports (this way they can be qualified). I got something to work but it's a really hacky solution that's probably worse than before. |
A great big |
As a note to myself, #2423 should also add a sentence ending operator |
I'm having a little bit of trouble incorporating
(this was also posted under the PR but that has been merged and closed so I put it here too) |
For the postfix operators, you need to enable the PostfixOperators language extensions (e.g., Here's a small example of a postfix operator:
Regarding the |
I wanted to make an operator that would take a sentence and just append a period to the end of it. Dr. Carette suggested I call it * Couldn't match expected type `t0 -> t1'
with actual type `Sentence'
* The operator `(+.)' takes two arguments,
but its type `Sentence -> Sentence' has only one
In the expression: ((S "So then") +.)
In an equation for `angFrequencyDerivSent2':
angFrequencyDerivSent2 = ((S "So then") +.)
|
248 | angFrequencyDerivSent2 = ((S "So then") +.)
| Would it be better to define it as a Data Constructor instead like |
Hmm, do you mind showing your full code snippet (w/ |
Here is the current definition: -- | Helper which appends a period to the end of a sentence
(+.) :: Sentence -> Sentence
(+.) a = a :+: S "." And here is where I was trying to implement it (as a test to see if it worked): angFrequencyDerivSent2 = ((S "So then") +.) |
So does that now work? |
It works perfectly as a normal function like this: angFrequencyDerivSent2 = ((+.) (S "So then")) but it gives me this error when placed as a postfix: * Couldn't match expected type `t0 -> t1'
with actual type `Sentence'
* The operator `(+.)' takes two arguments,
but its type `Sentence -> Sentence' has only one
In the expression: ((S "So then") +.)
In an equation for `angFrequencyDerivSent2':
angFrequencyDerivSent2 = ((S "So then") +.)
|
248 | angFrequencyDerivSent2 = ((S "So then") +.)
| |
Did you enable |
Yes that works thanks! |
Back to the original issue, the current set of functions available for concept-level combinations block out the case of using |
So I think we'll want to think about levels of combinators:
Right now, level 3 combinators are best, but I'm not sure how many we'll truly be able to create. We should keep our eyes open for level 4 too. When that's not possible, then yes, some chainable level 2 combinators would be better than dropping all the way down to 1. Do try to keep notes on this. There might be a paper here. |
This issue should eventually apply to all examples, but it can start at DblPendulum. It should be done after the first part of #2398 is done.
Drasil/code/drasil-example/Drasil/DblPendulum/Unitals.hs
Lines 47 to 57 in dc6da83
Note the
(phrase angle
the_ofThephrase pendulum)
(and same withrod
). What's going on is that there is a sentence-level combinatorthe_ofThe
being used. That's a fine thing, but in common use, it's applied on concepts, so explicit extraction needs to happen.Better would be a combinator, in a separate package that can be imported qualified (say as
C
) so that this could instead beangle C.the_ofThe pendulum
. In fact, even better would be if the sentence-level combinator was imported qualified (asS
) and the concept-level ones not qualified, so that this could beangle the_ofThe pendulum
or eventhe angle ofThe pendulum
(there's athe
combinator too!).The point is that this piece of English actually is very semantic. It embodies the pattern "the unique attribute X associated to the unique object Y" where here X = angle and Y = pendulum. Recognition of the semantics of what the English is actually saying will let us generalize things.
This is another issue that requires some local fixes, as well as the creation of further issues that detail the future work that needs to be done to improve the examples overall.
The text was updated successfully, but these errors were encountered: