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

Unify numeric type class instances #483

Merged
merged 14 commits into from
Apr 21, 2018
Merged

Unify numeric type class instances #483

merged 14 commits into from
Apr 21, 2018

Conversation

fthomas
Copy link
Owner

@fthomas fthomas commented Apr 20, 2018

This changes the definition of MaxSize[N] from Size[LessEqual[N]] to Size[Interval.Closed[_0, N]] and adds the WitnessAs type class which unifies numeric type class instances that were split to work with literal singleton types and shapeless.Nat.

Closes #473

A type class that converts the type `A` to a value of type `B`.
... to `type MaxSize[N] = Size[Interval.Closed[_0, N]]` and use
`AsValueOf` for the `Arbitrary` instance of `Interval.Closed[L, H]`
so that we can generate instances where the LUB of `L` and `H` is
`Any` (as for example in ``Interval.Closed[_0, W.`10`.T]``).
The instances with `AsValueOf` works for both `Nat` and primitive types.
@codecov
Copy link

codecov bot commented Apr 20, 2018

Codecov Report

Merging #483 into master will decrease coverage by 1.41%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #483      +/-   ##
==========================================
- Coverage   94.47%   93.05%   -1.42%     
==========================================
  Files          61       62       +1     
  Lines         688      677      -11     
  Branches       12       12              
==========================================
- Hits          650      630      -20     
- Misses         38       47       +9
Impacted Files Coverage Δ
...src/main/scala/eu/timepit/refined/collection.scala 100% <ø> (ø) ⬆️
...ed/src/main/scala/eu/timepit/refined/api/Max.scala 100% <100%> (ø) ⬆️
...ed/src/main/scala/eu/timepit/refined/api/Min.scala 100% <100%> (ø) ⬆️
...c/main/scala/eu/timepit/refined/types/string.scala 100% <100%> (ø) ⬆️
...ed/src/main/scala/eu/timepit/refined/generic.scala 20% <100%> (-22.86%) ⬇️
.../scala/eu/timepit/refined/scalacheck/numeric.scala 100% <100%> (ø) ⬆️
.../scala/eu/timepit/refined/internal/WitnessAs.scala 100% <100%> (ø)
...ed/src/main/scala/eu/timepit/refined/numeric.scala 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f72cae...4443b36. Read the comment docs.

@fthomas fthomas changed the title WIP: AsValueOf Unify numeric type class instances Apr 21, 2018
@fthomas fthomas merged commit 54f395a into master Apr 21, 2018
@fthomas fthomas deleted the topic/AsValueOf branch April 21, 2018 20:12
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.

1 participant