-
Notifications
You must be signed in to change notification settings - Fork 157
Add documentation Manual.md and DesignPrinciples.md #5044
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
base: master
Are you sure you want to change the base?
Conversation
c0eec76
to
a24809b
Compare
@TimSheard it looks like you've formatted this with the old version of |
d1be307
to
df8f7d4
Compare
457faef
to
7094b77
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.
I am not really keen on adding another 3K lines of code that will be unused in Ledger. We should create a separate sub library in the constraint-generators
that will contain all of the example code and manuals.
In other words, could you please follow an example of a testlib
from one of our packages to add a separate sub library to constraint-generators
that will include all of the code that is being added in this PR.
4601aee
to
cf7a5a5
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.
As far as I got today. I'll try to have a look at the minimal implementation after lunch.
@@ -749,7 +749,7 @@ class Forallable t e | t -> e where | |||
-- IsPred | |||
|
|||
class Show p => IsPred p where | |||
toPred :: p -> Pred |
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 would prefer not to change this and keep Pred
wherever possible.
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 am not sure I understand what you are getting at. Are you suggesting not using IsPred at all in the Minimal implementation?
-Wcompat | ||
-Wincomplete-record-updates | ||
-Wincomplete-uni-patterns | ||
-Wpartial-fields | ||
-Wredundant-constraints | ||
-Wunused-packages |
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.
-Wcompat | |
-Wincomplete-record-updates | |
-Wincomplete-uni-patterns | |
-Wpartial-fields | |
-Wredundant-constraints | |
-Wunused-packages |
|
||
The function symbols of `Bool` are: | ||
|
||
1. `or_ :: Term Bool -> Term Bool -> Term Bool` |
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'm still not super keen on us supporting or_
as it behaves quite counterintuitively...
Also, to be consistent with the rest of the design it should be called (||.)
Now this isn't a very good test either, since the precedent is alway true. A better solution would be to | ||
generate a mix, where the precedent is True most of the time, but sometimes False. |
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.
C.f. my other comment about this not being true.
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, I'd like to make this better. Lets talk about that.
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.
perils of overconstraining
using classify to observe this
using cover.
Where the `classify` statistics are reported. | ||
|
||
<a id="weights"></a> | ||
### Classify with weights 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.
Maybe talk also about using cover
here to actually require a specific distribution. This can be very helpful to make sure you're not over-constraining your generators.
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 idea, I'll try and come up with an example.
class Container t e | t -> e where | ||
fromForAllSpec :: (HasSpec t, HasSpec e) => Spec e -> Spec t | ||
forAllToList :: t -> [e] |
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 this code, do we use forAll
on anything other than Set
? In which case we could simplify this too so that forAll
only supports Set
and we could explain that you can easily generalize it if you want in text.
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.
We could do that. Or we could make it clear, that in the Minimal implementation it only is used on Set, but in the full implementation it is used in List and Map as well.
|
||
data IntegerSym (dom :: [Type]) rng where | ||
PlusW :: IntegerSym '[Integer, Integer] Integer | ||
MinusW :: IntegerSym '[Integer, Integer] Integer |
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.
What about Negate
instead?
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.
That would give us more examples of different arities
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.
Didn't think about that. But we do use both (+.) and (-.) in the some examples.
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.
go back to negate
GenError xs -> ErrorSpec (catMessageList xs) | ||
FatalError es -> error $ catMessages es | ||
|
||
------- Stages of simplifying ------------------------------- |
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.
It's a shame we need a bunch of this stuff for this "simplified" version of the system to work. I'd like to sit down once we've shrunk the code-base here some more and see if I can get rid of some of this.
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.
The problem is that making a SolverPlan, requires all this stuff. We don't talk about how we do that, only what the result looks like, and how it is used.
4df2893
to
0df0af3
Compare
…on of the system. The idea is that is easier to explain, since it doesn't have things like Generics. It consists of Constrained.Min.Base.hs, Constraied.Min.Syntax.hs, Constrained.Min.Model.hs, and Constrained.Min.Tuple.hs Added the file docs/constrained/DesignPrinciples.md that describes this minimal system.
This is a basic manual about how to write constraints, but does not go into details about how the system is implemented.
516a803
to
b40b303
Compare
We add two documents that describe the constrained-generators module
Incorporates PR #4985, so all documentation is added in one PR, and documents can cross reference each other.
Checklist
CHANGELOG.md
files updated for packages with externally visible changes.NOTE: New section is never added with the code changes. (See RELEASING.md).
.cabal
andCHANGELOG.md
files when necessary, according to theversioning process.
.cabal
files updated when necessary.NOTE: If bounds change in a cabal file, that package itself must have a version increase. (See RELEASING.md).
scripts/fourmolize.sh
).scripts/cabal-format.sh
).scripts/gen-cddl.sh
)hie.yaml
updated (usescripts/gen-hie.sh
).