Skip to content

Commit

Permalink
Add NonEmptySet (#2143)
Browse files Browse the repository at this point in the history
* Add NonEmptySet

* Make NonEmptySet a semilattice and add extra test

* Fix doctest

* Remove AnyVal and rename to toSortedSet

* Add more docs

* Add concatMap

* Newtype encoding

* Move newtype to its own file

* Address feedback

* Remove Order constraint for fromSet constructor

* Remove Context bounds

* Make newtype private
  • Loading branch information
Luka Jacobowitz authored and kailuowang committed Mar 14, 2018
1 parent e3a12ef commit 3503cea
Show file tree
Hide file tree
Showing 5 changed files with 668 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/src/main/scala/cats/data/Newtype.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package cats
package data

/**
* Helper trait for `newtype`s. These allow you to create a zero-allocation wrapper around a specific type.
* Similar to `AnyVal` value classes, but never have any runtime overhead.
*/
private[data] trait Newtype { self =>
private[data] type Base
private[data] trait Tag extends Any
type Type[A] <: Base with Tag
}
Loading

0 comments on commit 3503cea

Please sign in to comment.