Releases: optics-dev/Monocle
Releases · optics-dev/Monocle
3.3.0
What's Changed
- Improve error messages for the
Focusmacro. 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
refocusto scala 2 by @julien-truffaut in #1206 - add generic
Indexfor 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
GenLensissue with evidence shadowing by @NTPape in #1265 - Fix
Plated.transformOfby @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
GenIsoto Scala 3 (#1185) @japgolly - Add
Iso.fields(#1197) @kenbot indexis 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
Focuspath. 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
andThento 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:
atandindex(#978) @sapizhakfilterIndex(#999) @julien-truffautas(#1110, #1123) @julien-truffauteach(#908) @julien-truffautwithDefault(#886) @julien-truffautto(#896) @TimWSpence
- add
orElseon Optional (#1021) @julien-truffaut - add cats instances to
zipLensestogether (#1109) @vaslabs - add
opticsextension method, deprecate allapplyXmethods (#1003) @julien-truffaut - generalise
Traversal.applyNto acceptOptionals(#1100) @julien-truffaut - add
POptionalintoIor's left and right (#893) @chwthewke - move
Mapinstance forEachandFilterIndexfromunsafemodule tocore(#998) @julien-truffaut
Deprecation
- Deprecate all
codiagonalexceptLens.codiagonal(#1115) @julien-truffaut - Deprecate
first,second,left,right,split. Movechoiceto cats instance (#1114) @julien-truffaut - deprecate symbolic compose operators (#983) @julien-truffaut
- deprecate
genericandstatemodule - 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
catsto 2.6.1 - Update
refinedto 0.9.26 - Update
scalajsto 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
zipLensestogether (#1109) @vaslabs - add
asextension 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
codiagonalexceptLens.codiagonal(#1115) @julien-truffaut - Deprecate
first,second,left,right,split. Movechoiceto 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
withDefaultfeature, removeEqconstraint (#1094) @kenbotat,indexfeatures (#1081) @kenbot- use
KeywordContextto restrictFocussyntax (#1079) @kenbot
API changes
- inheritance between optics (#1088) @julien-truffaut
- add
Focus[X]()and.focus()to generateIso/ApplyIso(#1098) @julien-truffaut - generalise
Traversal.applyNto takeOptionals(#1100) @julien-truffaut - remove
Atinstance for tuples, useFocuson tuples instead (#1096) @julien-truffaut - improve Iso.id composition performance (#1099) @julien-truffaut
3.0.0-M1
New features
- add
orElseon Optional (#1021) @julien-truffaut - add
filterIndexshortcut on all optics (#999) @julien-truffaut - add
atandindexshortcut on all optics (#978) @sapizhak - add
eachshortcut on all optics (#908) @julien-truffaut - add
withDefaultto fallback when on aNone(#886) @julien-truffaut - add
towhich lifts a function toGetter(#896) @TimWSpence - add
POptionalintoIor's left and right (#893) @chwthewke
API changes
- add
andThen, deprecate allcomposeXmethods (#967 #1000) @julien-truffaut - add
replace, deprecateset(#974) @sapizhak - add
replaceOption, deprecatesetOption(#1006) @jamesbruce97 - add
opticsextension method, deprecate allapplyXmethods (#1003) @julien-truffaut - move
Mapinstance forEachandFilterIndexfromunsafemodule 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
genericandstatemodule - 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
asfeature (#1050) @kenbot - add
eachfeature (#1072) @kenbot - add
Focusto all syntax import (#1058) @julien-truffaut Focusmacro pre-applied to object (#1039) @kenbot
Macro for Scala 3
GenLensredirect toFocus(#1037) @julien-truffautGenPrismredirect toFocus(#1063) @asjad02
Bug Fix
ApplyXXXmethods not fully applied (#1044) @julien-truffaut
Build and Dependency upgrade
- Update
refinedto 0.9.21 (#1078) @scala-steward - Update
catsto 2.4.2 (#1068) @scala-steward - Update
discipline-coreto 1.1.4 (#1066) @scala-steward - Update
scalajsto 1.5.0 (#1053) @scala-steward - Update
sbtto 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