Release Notes
2.0.1
09 January 2020
- bug fix: use fully qualified name in
Lensmacro #793 (thanks to enzief) - add
parModifyFtoTraversalleveragingcats.Parallel#751 (thanks to nigredo-tori) - add
At,IndexandEachinstances for ListMap #740, #742 #747 (thanks to jan0sch)
2.0.0 (cats only)
11 September 2019
- everything in 1.6.0
- add instances for
NonEmptyVector#564 (thanks to valydia) - add optics for cats
ChainandNonEmptyChain#609 (thanks to dcastro) - add missing functions (
mod,assignand variants) to State module #564 (thanks to valydia) - depends on cats 2.0.0
1.6.0 (scalaz only, last major release with scalaz)
14 July 2019
- add
applyhelper methods to typeclasses #560 (thanks to jbgi) - add
coProductIso,coProductDisjunctionIsoandtoGeneric#578 (thanks to dcastro) - add override modifiers in macro generated code #581 (thanks to omervk)
- add FieldsSyntax to global import #583 (thanks to kubukoz)
- fix name collisions in implicit classes #629 (thanks to vladimirkl)
- release from ci, stop support of scala 2.11 and scala native #646
- support scala 2.13 #669 (thanks to xuwei-k)
1.5.0 and 1.5.0-cats
3 January 2018
- add coalgebroid-based constructors for
LensandTraversal#502 (thanks to jeslg) - add state syntax for traversal #533 (thanks to jeslg)
- add
modifyFtoApplysyntax #525 (thanks to colin-passiv) - add optics composition table #532 (thanks to jdegoes)
- support scala native #508 (thanks to aoiroaoino)
-
bug fix: allow for annotations on companion objects of
@Lenses-annotated case classes #524 (thanks to hrhino) - create a cats branch where cats replaces scalaz #528 and #539 (thanks to sellout and tpolecat)
1.4.0
14 January 2017
Addition
- add
Eachinstance forTry,Either,scalaz.\/,scalaz.Validation#472 and #476 (thanks to n4to4) - add
Unzipinstance forLens,Fold,Optional,Traversal,Setter#474 (thanks to n4to4) - add refined
startsWithandendWith#480 and #483 (thanks to valydia, mrcmatuszak and fthomas) - add
uuid,url,uri#487 and #490 (thanks to mjjc and n4to4)
Other
- deprecate global constructor of typeclasses #478
- remove deprecated methods
sumandproduct#479 - execute packageSrc in travis-ci to avoid regressing like #492 #494 (thanks to xuwei-k)
1.4.0-M2
23 December 2016
- do not require java 8 for scala 2.11 #463
- add
Possibletypeclass #450 (thanks to kenbot) - add
zipandunzipforGetter#453 and #458 (thanks to lunaryorn) - upgrade scala to 2.12.1 and fix doc issue around SI-7139 #435
- upgrade scala.js to 0.6.14 #466
1.4.0-M1
16 December 2016
Addition
- add macro based syntax for
ApplyLens#434 (thanks to cvogt) - add lookup methods to various optics #425 (thanks to kubum, emmedema and julien-truffaut)
- add state ops for
GetterandSetter#415 (thanks to jeslg) - add
extract,extracts,assign_andmod_to state ops #415 (thanks to jeslg) - add
select#441 (thanks to sepulkarz) - add
lowerCaseandupperCase#446 (thanks to sindoudou)
Refactor
- major refactor of typeclasses #405:
- abstract class instead of trait. This would allow to add methods without breaking binary compatibility
- move typeclass instances from
monocle.std._to the typeclass companion object. This change will reduce the number of imports required to use a typeclass
- curry
find,existandall#425 - improve performance of
Indexinstance forListandVector#413 - simplify
Platedinstance forFree#404 (thanks to aoiroaoino) - remove
Orderinstance forChar#405 - prevent warning for
higherKindsinLensmacro #434 (thanks to cvogt)
Doc
- use
sbt-microsite#411 and #444 (thanks to VlachJosef) - new icons for website and stickers #421 (thanks to mbcltd)
- add doc for
Optional#424 (thanks to mdulac) - add doc for
Traversal#423
Other
kenjiaka xuwei-k is now a maintainer- update build settings for scala.js #406 (thanks to aoiroaoino)
1.3.2
02 November 2016
- add support for scala 2.12.0 #408
- use
Free.rollinPlated[Free[S, A]]instance #404 (thanks to aoiroaoino ) - update build settings for scala.js #406 (thanks to aoiroaoino )
1.3.1
21 October 2016
- add support for scala 2.12.0-RC2
1.3.0
18 October 2016
Addition
- add
unsafemodule withselect#394 (thanks to cesartl) - refactor optics laws to use random functions #357
- add
Wrappedtypeclass #365 (thanks to puffnfresh) - add
Statesyntax forOptional#387 (thanks to cb372) - add
transformMandtransformCountingtoPlated#391 (thanks to arkadius) - add
applyNforTraversal#379 (thanks to jule64) - add
mapping#396 (thanks to mdulac)
Deprecation
- remove all deprecated elements from 1.1 e.g. (
Lenser,headMaybe,getMaybe,setMaybe,modifyMaybe) (see)
Upgrades
| dependencies | monocle 1.2.2 | monocle 1.3.0 |
|---|---|---|
| scalaz | 7.2.2 | 7.2.6 |
| shapeless | 2.2.5 | 2.3.2 |
| refined | 0.3.2 | 0.5.0 |
| discipline | 0.4 | 0.7 |
1.2.2
9 June 2016
Addition
- add
applymethods forPrismandIso#354 (thanks to sellout) - add
unapplymethods forPrismandIso#361 (thanks to sellout) - add
partialconstructor forPrism#355 (thanks to sellout)
Documentation
1.2.1
13 April 2016
Addition
- support for scala.js #335 (thanks to japgolly)
remove: delete a value associated with a key in a Map-like container #341 (thanks to dabd)doubleToFloat,bigDecimalToLongandbigDecimalToInt#312 (thanks to mikaelv)- optics for
Tuple1#313 (thanks to exlevan) - use random index for
AtTestsandIndexTests#343 (thanks to pvillega) Eachinstance for tuples and case classes with fields of the same type #347 (thanks to Astrac)
Bug Fixes
- fix implicit not found message for
Plated#320 (thanks to aoiroaoino) - fix
stringToBooleansuch as it satisfies 2nd prism law #340 (thanks to hasumedic) - fix
stringToLongsuch as it satisfies 2nd prism law #339 (thanks to pvillega) - fix bit indexing for
Long#343 (thanks to pvillega)
Upgrades
- scala 2.11.8
- scalaz to 7.2.2
1.2.0
17 December 2015
Documentation
- add example, typeclass and faq sections to the website #314, #316
- document SI-7139 limitation for optics constructor in REPL and tut #309
Bug Fixes
- generate fresh type-parameter name for
modifyF#300 (thanks to puffnfresh) - publish
monocle-refinedwith all the other modules #311 - publish snapshot automatically for scala 2.10 and 2.11 #310
Upgrades
- scalaz to 7.2.0
- refined to 0.3.2
- macro paradise to 2.1.0
1.2.0-M2
22 November 2015
Thanks to all the 14 contributors since 1.2.0-M1
Addition
- add
onlyPrismto match a single value see - add
belowPrismto lift aPrismin aTraversesee - add
lengthforFoldandTraversal#236 (thanks to aoiroaoino) - add optics for
scalaz.Either3#242 (thanks to aoiroaoino) - add
optNelToListIsosee - add
fromIsocombinator for all optics #245 - add
leftandrightmethods forIso,Prism,GetterandFold#273 - add safe down cast from BigInt #267
- add
productToTupleIsobetween case class and tuple using shapeless #247 - add
GenIso.fieldswhite box that generates the sameIsothanproductToTuplewith better performances but less IDE support #297 (thanks to japgolly) - add
@PLensesmacro annotation to generatePLensfor case class with type parameters #114 (thanks to exlevan) - add
Platedtypeclass #289 (thanks to puffnfresh) - add optics for
scalaz.Cofree#290 (thanks to LiamGoodacre)
Non backward compatible change
- change mega imports from package object to
allobject, e.g.import monocle.function._becomesimport monocle.function.all._#243 - change
Atdefinition fromdef at(index: I): Lens[S, Option[A]]todef at(index: I): Lens[S, A] - change
Atinstance forSetandISetfromLens[S, Option[Unit]]toLens[S, Boolean] - remove
Indexinstances for bit indexing primitiveLong,Int,Char,Byefrommonocle-core - add
monocle-refinedmodule withAtinstances for bit indexing primitiveLong,Int,Char,Bye#291 (thanks to fthomas and julien-truffaut)
Deprecation
- deprecate
theseDisjunctiontotheseToDisjunctionsee - deprecate
nelAndOneIsotonelToOneAndsee - deprecate
sumtochoiceandproducttosplit#239
Documentation
- add tut examples for
Prism#228 - add tut examples for
Iso#279 (thanks to justjoheinz) - add examples for Http Request optics usage #262 (thanks to 1ambda)
- add learning resources to the website #251
Bug Fixes
Optimisation
Upgrades
- scala to 2.10.6
- scalaz to 7.1.4
- shapeless to 2.2.5
- macro-compat to 1.1.0
- macro paradise to 2.1.0-M5
1.2.0-M1
06 July 2015
- laws definition move to
coremodule see. Properties are still defined inlawmodule with discipline - optics defined for
scalaz.Validation#211 (thanks to anakos) hListAtis now public see- add basic state support for
Lensin an experimentalstatemodule see - add
voidforOptional,Traversal,FoldandSettersee - add
Setterconstructor usingscalaz.Contravariantandscalaz.Profunctorsee GenIsofor object and empty case classes #219 and #223 (thanks to adelbertc)- add
optionToDisjunctionIso#226 (thanks to aoiroaoino) - add monomorphic optics for
Option,Either,scalaz.Disjunction,scalaz.Validation#181
Build
- publish snapshot automatically #207
- create basic web site using compile time verified examples with
tut#227
Bug Fixes
Upgrades
- scala to 2.10.5 and 2.11.7
- scalaz to 7.1.3
- shapeless to 2.2.3
- kind projector to 0.6.0
1.1.0
31 Mars 2015
All Optics are now abstract classes
- easier to change implementation and maintain backward compatibility
- offer faster implementation using macros or
new(not recommended)
Deprecate use of Maybe and IList in interface
- 1.0.0 replaced
Optionbyscalaz.Maybebut it turns out thatMaybeadvantages are not worth the cost of moving away from scala std. - same between
Listandscalaz.IList
Add Category related instances and methods
- type classes e.g.
Compose,Category,Arrow,Choice - methods e.g.
id,codiagonal,first,second,sum,product
Macro
monocle.macros.GenIsogeneratesIsofor case class with a single accessormonocle.macros.GenPrismgeneratesPrismfor sealed trait@Lensesnow supports case classes with type parameters seeLenseris deprecated, useGenLensinstead (same functionality but more consistent naming)
Spark friendly
- Optics and type classes extends
Serializable
Syntax
- using optics as an infix operator operator requires a single import
monocle.syntax.applyormonocle.syntax._
1.0.0
14 December 2014
Rename Optics
Iso,Lens,Prism,Optional,TraversalandSetterwere prepended by a P for PolymorphicSimpleIso,SimpleLens,SimplePrism,SimpleOptional,SimpleTraversalandSimpleSetterlostSimple- for example,
Lenswas renamed toPLensandSimpleLenstoLens - benefits: in practice most optics are not polymorphic, so it is more convenient to have a shorter name for the most used optics.
No inheritance between Optics
- All Optics use
asXmethods to transform Optics, e.g.Prism[S, T, A, B]has methodsasOptional: Optional[S, T, A, B],asTraversal: Traversal[S, T, A, B], … methods
Compose direction
- in 0.5,
composeYmeant that the result of the composition is an Optic of typeY - in 1.0,
composeYmeans that you compose with an Optic of typeY
Main method changes
- removed
set,modify,setOption,modifyOption setFbecamesetsetFOptionbecamesetMaybemodifyFbecamemodifymodifyFOptionbecamemodifyMaybemodifyFbecameliftormultiLiftdepending on the OpticgetOptionbecamegetMaybe
Simplified Constructors
- Curry Optics constructor and merged Simple Optic constructors
- Shuffle methods and parameters order to be consistent between Optics
Use Maybe and IList from scalaz instead of Option and List from std
Maybecan be transformed toOptionby callingtoOptionIListcan be transformed toListby callingtoList- benefits: no variance, better scalaz support, safer methods
Simplified type classes
- merged
HeadOptionandTailOptionintoCons - merged
HeadandTailintoCons1 - merged
InitOptionandLastOptionintoSnoc - merged
InitandLastintoSnoc1 - removed
SafeCastas it was simply a way to summonPrismimplicitly - removed
AtBitand definedIndex[S, Int, Boolean]whereSis a numeric type
Macros
- all macros have been moved to
monocle.macrospackage mkLenshas been moved tomonocle.macros.internal, i.e. it is not public anymore. UseLenseror@Lenses
0.5.1
29 September 2014
Macros
- Add
@LensesMacro annotation to generateSimpleLensautomatically for case classes - Add
LenserMacro to generateSimpleLenswith a better IDE support than Macro annotation - Deprecate
mkLensMacro asLenseris strictly more powerful
Bug Fix
- Fix
SafeCastbetweenStringtoInt
0.5.0
03 August 2014
Build and Dependencies
- Upgrade scalaz dependency from 7.0.6 to 7.1
- Upgrade specs2 dependency from 2.3.11 to 2.4
- Build with scala 2.11.2
- Use sbt-typelevel plugin
Breaking Changes
- SimpleOptional apply method takes a setter function from
(S, A) => Ainstead of(S, Option[A]) => A - Polymorphic optics instance reorganisation: All instances has been move from the companion objects of the
polymorphic optics to packages:
monocle.stdfor standard Scala and scalaz classesmonocle.genericfor shapeless classes
Check out this example to see how it affects imports
- reverseModify has been moved from Monocle package object to
Prismsyntax
New Features
- Add setOption and modifyOption for
Optional - Flipped curried version of
set => setF,modify => modifyF,setOption => setOptionF,modifyOption => modifyOptionFSee example - New constructors for simple optics with better type inference, see example
- implicit not found annotations have been added to polymorphic optics to help user figuring out which import is missing
monocle.scalaz.Eitherhas been renamedmonocle.scalaz.Disjunctionto avoid clashes withmonocle.std.Either- Add
Each,Index,Field1,Head,TailandLastOptioninstances forscalaz.OneAnd - Add
Each,HeadOption, andLastOptionforscala.Some
0.4.0
28 May 2014
Modularity and build
- Cross build for scala 2.10.4 and 2.11.0
- Move Optic Laws from module core to law module
- Move
Macrofrom module core to macro module - Update dependencies
- Remove scalacheck, scala-reflect and scala-compiler dependencies from core
- upgrade scalacheck to 1.11.3
- Add Mima support on core to check for binary compatibility between minor version for next releases
New major concept: Optional
- Add
Optionala new major concept that represents a 0-1Traversal.Optionalis a sub class ofTraversaland a super class ofLensandPrism. Composing aLensand aPrismcreates anOptionalinstead of aTraversal, hence we maintain information that the resulting Optic zooms to an optional object and not a list - Rename
Head->HeadOption,Last->LastOption,Tail->TailOptionandInit->InitOption - Change
HeadOption,LastOption,TailOption,InitOptionOptic fromTraversaltoOptional
Functions
- Generalize
Reverse,TailandInitfrom 1 to 2 types parameters. - Add
Head,Last,Tail,Initfunctions with the same semantic than the Option (HeadOption, …) variant except that their Optic is aLensand not anOptional. This implies thatHead,Last,Tail,Initcan only be defined on elements with a mandatory head, last, tail and init. Implemented on 2-6 tuple andHList. - Implemented
Reverseinstances on all tuple andHList. - Implemented
Reverse,Head,Last,Tail,Initinstances on all tuple andHList. - Implemented
HeadOption,LastOption,TailOption,InitOption,Each,IndexandFilterIndexfor scalazIList.
Miscellaneous
- Add reverseModify on
SimplePrismas an alias forgetOption map modify. - Add syntax for
Getter,FoldandSetter. - Add non symbolic functions to use Optics as operators, e.g.
List(1,2,3) applyTraversal each getAllinstead ofList(1,2,3) |->> each getAll - Add import for all syntax:
import monocle.syntax._
0.3.0
02 May 2014
- Update dependencies - scala to 2.10.4 - shapeless to 2.0.0 - macro paradise to 2.0.0 - quasi quotes to 2.0.0
- Add apply4 to apply6 methods to Traversal
- Add
Eachinstance for 4 to 6 tuple of same type - Generic sub module:
- Add
Field1toField6instances forHList- AddSafeCastinstance forCoproduct, hence supporting Prism for sealed family - Remove_1,_2,_3Lens using shapelessGeneric, since composingtoHListIso andFieldsLens is equivalent
0.2.0
27 April 2014
- Add generic Lens, Traversal, Iso and Prism in monocle.function:
_1,_2, …,_6, Lens to focus on the ith element of a tuple. Implemented for tuple of size 6 or lessatBit(i: Int), Lens to focus on ith Bit. Implemented for Boolean, Byte, Char, Int and LongsafeCast, Prism defining a safe down casting between two types. Implemented for most primitive type and Stringcurryanduncurry, Iso for functions with up to 5 parametersheadandlast, Traversal to the first and last element respectively. Implemented for std List, Vector, Stream, Option and Stringtailandinit, Traversal to all elements except first and all elements except last respectively. Implemented for std List, Vector, Stream and Stringreverse, Iso that reverses the order of elements. Implemented for std List, Vector, Stream, String and scalaz Treeindex(i: Int), Traversal to focus on ith element. Implemented for std List, Vector, Stream, Map and Stringeach, Traversal to focus on all elements. Implemented for std List, Vector, Stream, Option, Map, String, pair and triple of same type and scalaz treefilterIndex(predicate: Index => Boolean), Traversal to focus on all elements with index verifying predicate. Implemented for List, Vector, Stream, Map and Stringat(key: K), Lens to focus on an optional element at a key, strictly more powerful than index as it permits to add and delete elements. Implemented for Map
- Alias for Iso, Prism, Lens and Traversal composition:
<-> == composeIso?-> == composePrism|-> == composeLens|->> == composeTraversal
- Add experimental sub project generic, using shapeless to generate Iso between
HListand case class or tuple - Add documentation in examples
0.1.0
27 February 2014
- First release