Releases: optics-dev/Monocle
Releases · optics-dev/Monocle
3.3.0
What's Changed
- Improve error messages for the
Focus
macro. by @yilinwei in #1413 - Move Scala 3 tests to correct directory by @armanbilge in #1381
- update docs to use correct groupId by @jopecko in #1352
- add explicit type for implicit methods by @xuwei-k in #1365
- add explicit type for implicit by @xuwei-k in #1366
- Scala 3.3.0 by @xuwei-k in #1356
- Update scala-native to 0.5
- Update alleycats-core, cats-core, cats-free, ... to 2.10.0 by @scala-steward in #1382
New Contributors
Full Changelog: v3.2.0...v3.3.0
3.2.0
What's new
- add
refocus
to scala 2 by @julien-truffaut in #1206 - add generic
Index
for various Scala 2 sequences by @skozlov in #1285 - Cross-build for Scala Native by @armanbilge in #1310
- Bump scala3 version to 3.2.1 by @scala-steward in #1316
Bug Fix
- Fix maven badge on website by @justjoheinz in #1234
- Fix
GenLens
issue with evidence shadowing by @NTPape in #1265 - Fix
Plated.transformOf
by @GreyPlane in #1319
New Contributors
- @NTPape made their first contribution in #1265
- @skozlov made their first contribution in #1285
- @armanbilge made their first contribution in #1307
- @GreyPlane made their first contribution in #1319
Full Changelog: v3.1.0...v3.2.0
3.1.0
What's Changed
case class User(name: String, address: Address)
case class Address(streetNumber: Int, street: Option[Street])
val elise = User("Elise", Address(12, Some(Street("high street"))))
val addressLens: Lens[User, Address] = Focus[User](_.address)
val newLens : Lens[User, Int] = addressLens.refocus(_.streetNumber)
newLens.replace(50)(elise)
// or using the applied syntax
import monocle.syntax.all._
elise.focus(_.address).refocus(_.streetNumber)
- Add
GenIso
to Scala 3 (#1185) @japgolly - Add
Iso.fields
(#1197) @kenbot index
is now a direct method for all optics for better Cats compat (#1192) @kenbot- Avoid indirect call to
AsPrismImpl
(#1186) @nicolasstucki - Fix #1177 where Focus could not operate on type aliases (#1178) @kenbot
Dependencies
- Update sbt-scalajs, scalajs-compiler, ... to 1.7.0 (#1187) @scala-steward
- Update refined, refined-scalacheck to 0.9.27 (#1179) @scala-steward
3.0.0
- Change the organisation from com.github.julien-truffaut to dev.optics
libraryDependencies ++= Seq(
"dev.optics" %% "monocle-core" % "3.0.0",
"dev.optics" %% "monocle-macro" % "3.0.0", // only for Scala 2.13
)
Focus macro
import monocle.Focus
case class User(name: String, address: Address)
case class Address(streetNumber: Int, streetName: String)
Focus[User](_.name)
// res: Lens[User, String]
Focus[User](_.address.streetNumber)
// res: Lens[User, Int]
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 - [Scala 3 only] field selection on case classes with a single field generates an
Iso
(#1111) @kenbot
import monocle.Focus
case class UserId(value: Long)
Focus[UserId](_.value)
// 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
3.0.0-RC2
What's Changed
- move organisation from Julien account to dev.optics (#1162) @julien-truffaut
libraryDependencies ++= Seq(
"dev.optics" %% "monocle-core" % "3.0.0-RC2",
"dev.optics" %% "monocle-macro" % "3.0.0-RC2", // only for Scala 2.13
)
- Scala 3.0.0 (#1158) @xuwei-k
- Update alleycats-core, cats-core, cats-free, ... to 2.6.0 (#1139) @scala-steward
- Update sbt-scalajs, scalajs-compiler, ... to 1.5.1 (#1134) @scala-steward
3.0.0-M4
Focus macro
- add subtype constraint to
as
(#1112) @kenbot - field selection on case classes with a single field generates an
Iso
(#1111) @kenbot
API update
- add cats instances to
zip
Lenses
together (#1109) @vaslabs - add
as
extension method to all optics (#1110, #1123) @julien-truffaut - use
monocle.syntax.all._
for all extension methods (including macros) for both Scala 2 and 3 (#1120) @julien-truffaut - add inheritance between
AppliedOptics
(#1116) @julien-truffaut - add type aliases for
AppliedOptics
(#1113) @julien-truffaut - Deprecate all
codiagonal
exceptLens.codiagonal
(#1115) @julien-truffaut - Deprecate
first
,second
,left
,right
,split
. Movechoice
to cats instance (#1114) @julien-truffaut
Documentation
- enable scalajs-mapSourceURI option if Scala 3 (#1107) @xuwei-k
- add source links to scala 3 documentation. (#1108) @romanowski
3.0.0-M3
Focus Macro
- add support for tuple field selection (#1095) @kenbot
withDefault
feature, removeEq
constraint (#1094) @kenbotat
,index
features (#1081) @kenbot- use
KeywordContext
to restrictFocus
syntax (#1079) @kenbot
API changes
- inheritance between optics (#1088) @julien-truffaut
- add
Focus[X]()
and.focus()
to generateIso
/ApplyIso
(#1098) @julien-truffaut - generalise
Traversal.applyN
to takeOptionals
(#1100) @julien-truffaut - remove
At
instance for tuples, useFocus
on tuples instead (#1096) @julien-truffaut - improve Iso.id composition performance (#1099) @julien-truffaut
3.0.0-M1
New features
- add
orElse
on Optional (#1021) @julien-truffaut - add
filterIndex
shortcut on all optics (#999) @julien-truffaut - add
at
andindex
shortcut on all optics (#978) @sapizhak - add
each
shortcut on all optics (#908) @julien-truffaut - add
withDefault
to fallback when on aNone
(#886) @julien-truffaut - add
to
which lifts a function toGetter
(#896) @TimWSpence - add
POptional
intoIor
's left and right (#893) @chwthewke
API changes
- add
andThen
, deprecate allcomposeX
methods (#967 #1000) @julien-truffaut - add
replace
, deprecateset
(#974) @sapizhak - add
replaceOption
, deprecatesetOption
(#1006) @jamesbruce97 - add
optics
extension method, deprecate allapplyX
methods (#1003) @julien-truffaut - move
Map
instance forEach
andFilterIndex
fromunsafe
module tocore
(#998) @julien-truffaut - add
filter
, deprecateunsafeSelect
(#988) @julien-truffaut - add
at(1)
,at(2)
... for tuples, deprecateFieldX
(#959) @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
Focus macro
- add
as
feature (#1050) @kenbot - add
each
feature (#1072) @kenbot - add
Focus
to all syntax import (#1058) @julien-truffaut Focus
macro pre-applied to object (#1039) @kenbot
Macro for Scala 3
GenLens
redirect toFocus
(#1037) @julien-truffautGenPrism
redirect toFocus
(#1063) @asjad02
Bug Fix
ApplyXXX
methods not fully applied (#1044) @julien-truffaut
Build and Dependency upgrade
- Update
refined
to 0.9.21 (#1078) @scala-steward - Update
cats
to 2.4.2 (#1068) @scala-steward - Update
discipline-core
to 1.1.4 (#1066) @scala-steward - Update
scalajs
to 1.5.0 (#1053) @scala-steward - Update
sbt
to 1.4.7 (#1017) @scala-steward - Bump coursier/cache-action from v3 to v5 (#963) @dependabot
- add
dependabot.yml
(#962) @xuwei-k - Upgrade obsolete github actions (#958) @cquiroz
- Port tests to
munit
(#943) @cquiroz - Scala 3.0.0 (#937) @cquiroz
- Update scalafmt (#915) @cquiroz
Release 2.1.0
What's changed:
Updates
Release 2.0.4
- Support Scala.js 1.0