Skip to content

Commit

Permalink
Test NonEmptyLazyList, add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MateuszKubuszok committed Apr 24, 2024
1 parent b905b9e commit 3453639
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.scalaland.chimney.cats

import cats.data.NonEmptyLazyList
import io.scalaland.chimney.ChimneySpec
import io.scalaland.chimney.dsl.*

class CatsData213Spec extends ChimneySpec {

test("DSL should handle transformation to and from cats.data.NonEmptyLazyList") {
List("test").transformIntoPartial[NonEmptyLazyList[String]].asOption ==> Some(NonEmptyLazyList("test"))
List.empty[String].transformIntoPartial[NonEmptyLazyList[String]].asOption ==> None

NonEmptyLazyList("test").transformInto[List[String]] ==> List("test")
}
}
13 changes: 12 additions & 1 deletion docs/docs/cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,16 @@ Cats integration module contains the following utilities:
`UnorderedFoldable`, `Invariant`, `Semigriupal`, `NonEmptyAlternative`, `SemigroupK`, `MonoidK`)
- `Parallel[partial.Result]` (implementing also`NonEmptyParallel`)
- `Semigroup[partial.Result.Errors]`
- instances for `cats.data` types allowing Chimney to recognize them as collections:
- `cats.data.Chain` (transformation _from_ and _to_ always available)
- `cats.data.NonEmptyChain` (transformations: _from_ always available, _to_ only with `PartialTransformer`)
- `cats.data.NonEmptyLazyList` (transformation: _from_ always available, _to_ only with `PartialTransformer`,
the type is only defined on 2.13+)
- `cats.data.NonEmptyList` (transformation: _from_ always available, _to_ only with `PartialTransformer`)
- `cats.data.NonEmptyMap` (transformation: _from_ always available, _to_ only with `PartialTransformer`)
- `cats.data.NonEmptySeq` (transformation: _from_ always available, _to_ only with `PartialTransformer`)
- `cats.data.NonEmptySet` (transformation: _from_ always available, _to_ only with `PartialTransformer`)
- `cats.data.NonEmptyVector` (transformation: _from_ always available, _to_ only with `PartialTransformer`)

!!! important

Expand Down Expand Up @@ -1498,4 +1508,5 @@ The only 2 difference they make is that:
- they allow usage of `everyMapKey` and `everyMapValue` in paths, just like with standard library's `Maps`.

An example of such collections are `java.util` collections for which support is provided via `TotallyBuildIterable`
and `TotallyBuildMap` in [Java collections' integration](#java-collections-integration).
and `TotallyBuildMap` in [Java collections' integration](#java-collections-integration), or `cats.data` types
provided in [Cats integration](#cats-integration).

0 comments on commit 3453639

Please sign in to comment.