Skip to content

Releases: optics-dev/Monocle

3.3.0

09 Aug 09:12
ae59b9a
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v3.2.0...v3.3.0

3.2.0

03 Jan 14:12
Compare
Choose a tag to compare

What's new

Bug Fix

New Contributors

Full Changelog: v3.1.0...v3.2.0

3.1.0

01 Sep 08:31
40221ed
Compare
Choose a tag to compare

What's Changed

  • Add refocus to all optics as an alias for .andThen(Focus(...)) (#1184) @kenbot
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)

Dependencies

3.0.0

12 Jul 10:28
7d59f9a
Compare
Choose a tag to compare
  • 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

  • new macro to generate optics from a path (similar to XPath/JsonPath) @kenbot and @yilinwei
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)
import monocle.Focus

case class UserId(value: Long)

Focus[UserId](_.value)
// res: Iso[UserId, Long]

API updates

Deprecation

Documentation

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 scalajsto 1.6.0

3.0.0-RC2

01 Jun 09:42
01697ce
Compare
Choose a tag to compare
3.0.0-RC2 Pre-release
Pre-release

What's Changed

libraryDependencies ++= Seq(
 "dev.optics" %% "monocle-core"  % "3.0.0-RC2",
 "dev.optics" %% "monocle-macro" % "3.0.0-RC2", // only for Scala 2.13
)

3.0.0-M4

31 Mar 10:22
d830780
Compare
Choose a tag to compare
3.0.0-M4 Pre-release
Pre-release

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

Documentation

3.0.0-M3

28 Feb 10:19
6474680
Compare
Choose a tag to compare
3.0.0-M3 Pre-release
Pre-release

Focus Macro

API changes

3.0.0-M1

18 Feb 15:33
20392fe
Compare
Choose a tag to compare
3.0.0-M1 Pre-release
Pre-release

New features

API changes

Focus macro

Macro for Scala 3

Bug Fix

Build and Dependency upgrade

Release 2.1.0

13 Oct 08:49
v2.1.0
30cfc2b
Compare
Choose a tag to compare

What's changed:

  • Add Iso involuton #869
  • Fix broken class diagram link in docs. #870
  • Replace deprecated ? with * #881

Updates

  • Update sbt-mdoc to 2.2.5 #883
  • Update sbt-scalajs, scalajs-compiler to 1.1.1 #873
  • Update sbt to 1.3.13 #872
  • Update sbt-microsites to 1.2.1 #875
  • Update sbt-scalafmt to 2.4.2 #879
  • Update scalaz-core to 7.3.2 #874

Release 2.0.4

05 Mar 19:26
v2.0.4
0788241
Compare
Choose a tag to compare
  • Support Scala.js 1.0