-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
# Conflicts: # core/src/main/scala/cats/syntax/all.scala
- Loading branch information
Showing
5 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package cats | ||
package syntax | ||
|
||
import cats.data.Nested | ||
|
||
trait NestedSyntax { | ||
implicit final def catsSyntaxNestedId[F[_], G[_], A](value: F[G[A]]): NestedIdOps[F, G, A] = | ||
new NestedIdOps[F, G, A](value) | ||
} | ||
|
||
final class NestedIdOps[F[_], G[_], A](val value: F[G[A]]) extends AnyVal { | ||
/** | ||
* Wrap a value in `Nested`. | ||
* | ||
* `x.nested` is equivalent to `Nested(x)`. | ||
* | ||
* Example: | ||
* {{{ | ||
* scala> import cats.implicits._ | ||
* scala> List(Some(3), None).nested.map(_+1).value | ||
* res0: List[Option[Int]] = List(Some(4), None) | ||
* }}} | ||
*/ | ||
def nested: Nested[F, G, A] = Nested[F, G, A](value) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters