Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
3.0.0 source code.tar.gz | 2021-07-03 | 10.3 MB | |
3.0.0 source code.zip | 2021-07-03 | 10.5 MB | |
README.md | 2021-07-03 | 3.6 kB | |
Totals: 3 Items | 20.8 MB | 0 |
-
Change the organisation from com.github.julien-truffaut to dev.optics
:::scala libraryDependencies ++= Seq( "dev.optics" %% "monocle-core" % "3.0.0", "dev.optics" %% "monocle-macro" % "3.0.0", // only for Scala 2.13 )
Focus macro
-
new macro to generate optics from a path (similar to XPath/JsonPath) @kenbot and @yilinwei
:::scala import monocle.Focus
case class User(name: String, address: Address) case class Address(streetNumber: Int, streetName: String)
FocusUser // res: Lens[User, String] FocusUser // res: Lens[User, Int] * pre-apply
Focus
to an object (#1039) @kenbot:::scala import monocle.syntax.all._
val anna = User("Anna", Address(12, "high street")
anna.focus(.name).replace("Bob") anna.focus(.address.some.streetNumber).modify(_ + 1) * [Scala 3 only] operators for
Focus
path. This feature was enabled by a trick found by @yilinwei [#1079] *as
(#1050 [#1112]) @kenbot *withDefault
(#1094) @kenbot *at
,index
(#1081) @kenbot *each
(#1072) @kenbot *some
@kenbot * [Scala 3 only] field selection on case classes with a single field generates anIso
(#1111) @kenbot:::scala import monocle.Focus
case class UserId(value: Long)
FocusUserId // res: Iso[UserId, Long]
API updates
- inheritance between optics (#1088 [#1116]) @julien-truffaut
- add
andThen
to compose (#967 [#1000]) @julien-truffaut - add
replace
, deprecateset
(#974) @sapizhak - add
replaceOption
, deprecatesetOption
(#1006) @jamesbruce97 - add
filter
, deprecateunsafeSelect
(#988) @julien-truffaut - add type aliases for
AppliedOptics
(#1113) @julien-truffaut - use
monocle.syntax.all._
for all extension methods including macros (#1120) @julien-truffaut - add shortcut to all optics for common composition patterns:
at
andindex
(#978) @sapizhakfilterIndex
(#999) @julien-truffautas
(#1110, [#1123]) @julien-truffauteach
(#908) @julien-truffautwithDefault
(#886) @julien-truffautto
(#896) @TimWSpence- add
orElse
on Optional (#1021) @julien-truffaut - add cats instances to
zip
Lenses
together (#1109) @vaslabs - add
optics
extension method, deprecate allapplyX
methods (#1003) @julien-truffaut - generalise
Traversal.applyN
to acceptOptionals
(#1100) @julien-truffaut - add
POptional
intoIor
's left and right (#893) @chwthewke - move
Map
instance forEach
andFilterIndex
fromunsafe
module tocore
(#998) @julien-truffaut
Deprecation
- Deprecate all
codiagonal
exceptLens.codiagonal
(#1115) @julien-truffaut - Deprecate
first
,second
,left
,right
,split
. Movechoice
to cats instance (#1114) @julien-truffaut - deprecate symbolic compose operators (#983) @julien-truffaut
- deprecate
generic
andstate
module - no replacement (#986) @julien-truffaut - deprecate
Possible
- no replacement (#992) @julien-truffaut - deprecate
Cons
,Cons1
,Snoc
,Snoc1
- no replacement (#984) @julien-truffaut - deprecate
Curry
,Empty
,Reverse
- no replacement (#980) @julien-truffaut
Documentation
- enable scalajs-mapSourceURI option if Scala 3 (#1107) @xuwei-k
- add source links to scala 3 documentation. (#1108) @romanowski
Dependency upgrade
- Update Scala to 3.0.0 and 2.13.5
- Update
cats
to 2.6.1 - Update
refined
to 0.9.26 - Update
scalajs
to 1.6.0