Skip to content
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

Initial import/port #1

Merged
merged 2 commits into from
Nov 4, 2011
Merged

Initial import/port #1

merged 2 commits into from
Nov 4, 2011

Conversation

tixxit
Copy link
Contributor

@tixxit tixxit commented Nov 4, 2011

The original Rational implementation and I ported the tests over to ScalaTest.

@non non merged commit fb2e3fd into typelevel:master Nov 4, 2011
non added a commit that referenced this pull request Aug 8, 2013
So, I went ahead and cleaned up the tests a bit, which included adding
a bunch of ScalaCheck properties. As soon as I did, the bugs started
popping out of the woodwork. There were three major classes of bugs:

1. Zero coefficient terms ending up in the map
2. Generating terms with the same degree via Map#map
3. Everything else

Type #1 was the most common. I ended up making the default constructor
private, and adding a factory method that removes zeros from the map
before calling new. I also added a few other strategic filters.

Type #2 caused problems with multiplication, and would potentially
have caused problems with the Iterable[Term[C]] constructor as well.
The issue here is essentially:

  Map(1 -> 9, 3 -> 6) map { case (k, v) => (k % 2, v) }

This returns Map(1 -> 6), since it discards the earlier (1, 9) tuple.
Obviously this caused us some problems.

Type #3 just encompassed everything else. The most notable bug here
was an issue when dividing by constants, where quotMod would hit a
divide-by-zero bug. I just special-cased that, which appeased
ScalaCheck. There may be a more principled solution.
non pushed a commit that referenced this pull request Aug 8, 2013
non pushed a commit that referenced this pull request Aug 29, 2013
non added a commit that referenced this pull request Aug 2, 2014
This commit is mostly to try to clean up the documentation and some
code formatting a bit. Apologies to @denisrosset -- I saw some of
my own code which I no longer like the look of and wanted to fix.

There are a few major changes, however.

One is that I did some refactoring to remove the .asInstanceOf calls.
Since this is a bit of a shift away from the previous code patterns
in Interval I wanted to explain the rationale.

Previously, the style was to always define all the logic in the parent
trait (e.g. Interval[A]). I find this style really elegant and readable.
However, there are (at least) two problems with it:

 1. Broadest return type in all cases
 2. Potential slowness with lots of cases

In this case #1 was causing problems. Starting from a Bounded interval,
we were losing track of the fact that lowerBound and upperBound would
return ValueBounds (since the generic implementations only guarantee
Bound[A]). I refactored Interval to require each subtype to define
those methods, allowing more precise return types.

From there, Bound[A] * Bound[A] only guarantees a Bound[A]. This was a
bit more challenging, but I added methods +~, -~, *~, and /~ which,
for two ValueBound[A] values, guarantee the result to be a ValueBound[A]
as well (they should also be a bit faster).

There's obviously a tension here -- I don't want to rewrite all the
interval code away from the current (nice) style. But in some cases
being more precise about return types (and not losing type information)
will help us have more efficient (and more direct) code.

Review by @denisrosset.
@non non mentioned this pull request Dec 22, 2014
denisrosset pushed a commit that referenced this pull request Feb 6, 2015
JoeWrightss pushed a commit to JoeWrightss/spire that referenced this pull request Apr 13, 2019
Turns out that everything works, the only problem is that the server's configurable is not passed to the CA manager when it is initialized. This change does just that. It also sets this option by default in the dev config, which should alleviate some hardships around server restarts. Fixes typelevel#420

```
Received 1 bundle after 7.326471ms

SPIFFE ID:		spiffe://example.org/test
SVID Valid After:	2018-04-10 23:47:17 +0000 UTC
SVID Valid Until:	2018-04-10 23:48:18 +0000 UTC
CA typelevel#1 Valid After:	2018-04-10 23:47:06 +0000 UTC
CA typelevel#1 Valid Until:	2018-04-11 00:47:16 +0000 UTC
CA typelevel#2 Valid After:	2018-02-09 23:20:33 +0000 UTC
CA typelevel#2 Valid Until:	2023-02-08 23:20:33 +0000 UTC
```

Signed-off-by: Evan Gilman <evan@scytale.io>
armanbilge referenced this pull request in armanbilge/spire Oct 19, 2021
Improve `cfor` / `fastFor` semantics, docs
armanbilge added a commit that referenced this pull request Oct 20, 2021
armanbilge pushed a commit that referenced this pull request Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants