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

Add NEL/NEV one #1707

Merged
merged 1 commit into from
May 28, 2017
Merged

Add NEL/NEV one #1707

merged 1 commit into from
May 28, 2017

Conversation

peterneyens
Copy link
Collaborator

NonEmptyList.one(x) is analogous to x.pure[NonEmptyList].

Alternative for NonEmptyList.of(x) where you don't pay the price of the varargs, which isn't used.

Benchmark for .of(1) and .one(1):

[info] Benchmark           Mode  Cnt          Score          Error  Units
[info] NelOfBench.nelOf   thrpt   20   14153921.124 ±    71083.406  ops/s
[info] NelOfBench.nelOne  thrpt   20  122074571.622 ± 25745302.862  ops/s
[info] NelOfBench.nevOf   thrpt   20   19260517.026 ±  2714989.060  ops/s
[info] NelOfBench.nevOne  thrpt   20   28379095.763 ±  3294357.173  ops/s

`NonEmptyList.one` is analogous to `_.pure[NonEmptyList]`.

Alternative for `NonEmptyList.of(x)` where you don't pay the price of
the varargs, which isn't used.
@codecov-io
Copy link

codecov-io commented May 27, 2017

Codecov Report

Merging #1707 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1707      +/-   ##
==========================================
+ Coverage   93.96%   93.96%   +<.01%     
==========================================
  Files         241      241              
  Lines        4091     4093       +2     
  Branches      160      158       -2     
==========================================
+ Hits         3844     3846       +2     
  Misses        247      247
Impacted Files Coverage Δ
core/src/main/scala/cats/data/NonEmptyVector.scala 100% <100%> (ø) ⬆️
core/src/main/scala/cats/data/Ior.scala 100% <100%> (ø) ⬆️
core/src/main/scala/cats/data/NonEmptyList.scala 97.27% <100%> (+0.02%) ⬆️

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 80d56e6...769be64. Read the comment docs.

Copy link
Contributor

@edmundnoble edmundnoble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@kailuowang
Copy link
Contributor

👍 really nice.

@kailuowang kailuowang merged commit ed03ce3 into typelevel:master May 28, 2017
@kailuowang kailuowang added this to the 1.0.0-MF milestone May 28, 2017
@peterneyens peterneyens deleted the nel-nev-one branch May 28, 2017 15:38
LukaJCB pushed a commit that referenced this pull request Oct 4, 2017
* cats.kernel.Hash and related instances (#1690)

* Hash laws

* all test passed

* Hash instances for tuples

* introduce implicit precedence in KernelBoiler: Order > PartialOrder > Eq; Hash > Eq.

* Add type alias in cats._; Add contravariant instance for `Hash`

* HashFunctions extends EqFunctions

* Move contravariant instances to separate trait, in accordance with (#1659)

* revert name change

* move EitherInstances1#EitherEq out

* Optimize hash computation on case classes without allocating a new object

* fixing the problem in CI build: method catsKernelStdOrderForChar()cats.kernel.instances.CharOrder in trait cats.kernel.instances.CharInstances has a different result type in current version, where it is cats.kernel.Order rather than cats.kernel.instances.CharOrder

* Full compliance with how Scala generates hash codes on case classes; +SetHash

* Cartesian[Hash]

* ContravariantCartesian[Hash]

* ContravariantCartesian[Hash]; Hash.fromHashing

* style issues

* remove unused import

* some test cases

* some test cases

* +test for Contravariant[Hash]

* +test for Contravariant[Hash]

* Add NEL/NEV one (#1707)

`NonEmptyList.one` is analogous to `_.pure[NonEmptyList]`.

Alternative for `NonEmptyList.of(x)` where you don't pay the price of
the varargs, which isn't used.

* move instances into separate trait (#1659)

* move instances into separate trait

* adding separate objects for piecemeal imports

* Adding implicit resolution tests for piecemeal imports for hierarchy

* Removing explicit implicitly and using apply method

* cats.kernel.Hash and related instances (#1690)

* Hash laws

* all test passed

* Hash instances for tuples

* introduce implicit precedence in KernelBoiler: Order > PartialOrder > Eq; Hash > Eq.

* Add type alias in cats._; Add contravariant instance for `Hash`

* HashFunctions extends EqFunctions

* Move contravariant instances to separate trait, in accordance with (#1659)

* revert name change

* move EitherInstances1#EitherEq out

* Optimize hash computation on case classes without allocating a new object

* fixing the problem in CI build: method catsKernelStdOrderForChar()cats.kernel.instances.CharOrder in trait cats.kernel.instances.CharInstances has a different result type in current version, where it is cats.kernel.Order rather than cats.kernel.instances.CharOrder

* Full compliance with how Scala generates hash codes on case classes; +SetHash

* Cartesian[Hash]

* ContravariantCartesian[Hash]

* ContravariantCartesian[Hash]; Hash.fromHashing

* style issues

* remove unused import

* some test cases

* some test cases

* +test for Contravariant[Hash]

* +test for Contravariant[Hash]

* cats.kernel.Hash and related instances (#1690)

* Hash laws

* all test passed

* Hash instances for tuples

* introduce implicit precedence in KernelBoiler: Order > PartialOrder > Eq; Hash > Eq.

* Add type alias in cats._; Add contravariant instance for `Hash`

* HashFunctions extends EqFunctions

* Move contravariant instances to separate trait, in accordance with (#1659)

* revert name change

* move EitherInstances1#EitherEq out

* Optimize hash computation on case classes without allocating a new object

* fixing the problem in CI build: method catsKernelStdOrderForChar()cats.kernel.instances.CharOrder in trait cats.kernel.instances.CharInstances has a different result type in current version, where it is cats.kernel.Order rather than cats.kernel.instances.CharOrder

* Full compliance with how Scala generates hash codes on case classes; +SetHash

* Cartesian[Hash]

* ContravariantCartesian[Hash]

* ContravariantCartesian[Hash]; Hash.fromHashing

* style issues

* remove unused import

* some test cases

* some test cases

* +test for Contravariant[Hash]

* +test for Contravariant[Hash]

* Fix duplication error and style error

* fix merge error

* remove instance for Cartesian[Hash]: it does not satisfy associativity

* +identityHash, +`hash` postfix method

* all tests passed

* increase coverage

* accidentally removed plugin, restore it

* all tests passed

* increase coverage

* increase coverage, ## => hashCode, kernelBoiler

* suppress mimaReportBinaryIssues

* Remove cats.functor

* Remove cats.functor
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.

4 participants