Modify deeply nested fields in case classes:
Chain modifications:
Modify conditionally:
As I played around with that idea, lot of side-ideas propped up and soon I had built a set of raw tools for a variety of on-screen tasks. I packaged those tools in QuickLens 1.0, that went live in June 2014 on the Mac App Store. Since then, these tools have matured into what you see today and integrated with a careful set of considerations. Buy Contact Lenses online with low prices from QUICKLENS.Surprisingly low prices on Acuvue Oasys, Focus Daillies, Air Optix, Biofinity, and many other contact lenses.Free shipping on all orders over $120.
Modify several fields in one go:
Traverse options/lists/maps using
.each
:.each
can only be used inside a modify
and 'unwraps' the container (currently supports Seq
s, Option
s andMaps
s - only values are unwrapped for maps).You can add support for your own containers by providing an implicit QuicklensFunctor[C]
with the appropriateC
type parameter.Traverse selected elements using
.eachWhere
:Similarly to
.each
, you can use .eachWhere(p)
where p
is a predicate to modify only the elements which satisfythe condition. All other elements remain unchanged.Modify specific elements in an option/sequence/map using
.at
:Similarly to
.each
, .at
modifies only the element at the given index/key. If there's no element at that index,an IndexOutOfBoundsException
is thrown. In the above example, .at(2)
selects an element in addresses: List[Address]
and .at
selects the lone possible element in street: Option[Street]
. If street
is None
, a NoSuchElementException
is thrown..at
works for map keys as well:Similarly to
.each
, .at
modifies only the element with the given key. If there's no such element,an NoSuchElementException
is thrown.Modify specific elements in an option/sequence/map using
.index
:Similarly to
.at
, .index
modifies only the element at the given index/key. If there's no element at that index,no modification is made. In the above example, .index(2)
selects an element in addresses: List[Address]
and .index
selects the lone possible element in street: Option[Street]
. If street
is None
, no modification is made..index
works for map keys as well:![Quicken Quicken](https://macx.ws/uploads/posts/2015-11/1446884229_quicklens_02.jpeg)
Similarly to
.at
, .index
modifies only the element with the given key. If there's no such element,no modification is made.Modify specific elements in an option or map with a fallback using
.atOrElse
:If
props
contains an entry for 'NumReports'
, then .atOrElse
behaves the same as .at
and the secondparameter is never evaluated. If there is no entry, then .atOrElse
will make one using the second parameter and perform subsequent modifications on the newly instantiated default.For Options,
.atOrElse
takes no arguments and acts similarly. .atOrElse
is currently not available for sequences because quicklens might need to insert many elements in the list in order to ensure that one is available at a particular position, and it's not clear that providing one default for all keys is the right behavior. Modify Either fields using
.eachLeft
and .eachRight
:Modify fields when they are of a certain subtype:
This is also known as a prism, see e.g. here.
Quicken 18
Re-usable modifications (lenses):
Alternate syntax:
Composing lenses:
or, with alternate syntax:
Modify nested sealed hierarchies:
Note: this feature is experimental and might not work due to compilation order issues.See https://issues.scala-lang.org/browse/SI-7046 for more details.
Similar to lenses (1,2), but without the actual lens creation.
Read the blog for more info.
Available in Maven Central:
Also available for Scala.js and Scala Native!
Commercial Support
We offer commercial support for Quicklens and related technologies, as well as development services. Contact us to learn more about our offer!
Copyright
Copyright (C) 2015-2019 SoftwareMill https://softwaremill.com.
Get 10% Off On Sitewide Voucher Code
Enjoy 10% discount on your any order by using coupon code at checkout. [WELC ]
Free Shipping New Zealand Wide Coupon
Take free New Zealand wide shipping on all orders over $98.
15% Discount On Order Quicklens NZ Promo Code
15% off on purchase of lens. [CPRE]
Take $5 Off On Purchase Quicklens.co.nz Voucher Code
NZ can get this deal! Enjoy $5 savings on any purchase. Shop more and save more. [GHST]
Take 20% Off Quicklens NZ Coupon Code
Recieve 20% off on all purchase of lenses. Go hurry and get fantastic savings. Focusrite midnight plugin suite 1 1 ubk download free. [STWI]
17% Off On Order Of OptiOne Daily Pack
Get 17% off on order of OptiOne Daily 30 Pack.
39% Off On Selected Purchase Coupon
Hurry! Once it's sold this opportunity will be gone. Get 39% off on order of selected order.
![Quicklens 1 8 pounds Quicklens 1 8 pounds](https://kaigai-bbs.com/up/thread/8c/b3/05/img_8cb305dc7a97ba53acf1800ecc905a76_large.jpg)
Take $10 Off Sitewide Promo Code
$10 off on all orders. [CPRA]
Get 15% Off On Any Order Quicklens NZ Promo
New Zealand can get this offer! Receive 15% discount on first time order. This offer will be only for limited time only.
Save 3% On Purchase Of FreshLook One-Day
Purchase now FreshLook One-Day 10 pack and get 3% discount. Shop today and get savings.
Get $1 Off On Order FreshLook Illuminate
Shop now and get $1 discount on order of FreshLook Illuminate.
15% Discount On Order Quicklens NZ Promo Code
Receive coupon code at checkout and get 15% discount on purchase of lens. [CPRE]
$10 Savings On All Orders Over $58
Spend $58 or more and get $10 off.Just paste code at checkout box and get savings. [SRNG]
Take 15% Off Sitewide Quicklens.co.nz Voucher Code
Rush and take 15% off on all orders. [CPRE]
Save 20% On Selected Items Coupon Code
Get 20% off on selected order. [AITW]
Enjoy 10% Discount On Order Promo Code
10% savings on order of selected items. [AIFI]
15% Savings On Selected Products
Use code while checking out to get 15% off on selected products. [AITE]
Get 15% Off Quicklens Coupon Code
Enjoy 15% off on order over $78. [BLFI]
10% Off For New Customer
Sign up for 10% discount on all orders.
10% Off Quicklens NZ Christmas Promo Code
Receive 10% off on all orders. [CRIS]
Quicklens 1 8 Pounds
15% Off Quicklens.co.nz Voucher Code
Receive 15% discount on all orders over $78. [SUMR]
Free Shipping On Order Coupon Code
Receive free shipping on all orders over $58. [NFRS]
Air Optix Aqua In Just $35.90
Get Air Optix Aqua starting from $35.90.
Acuvue Oasys From $31.90 At Quicklens NZ
Exactscan pro 18 12 24 – powerful fast document scanning. Take Acuvue Oasys as low as $31.90.
O2 Optix Starting With $34.90
Enjoy O2 Optix 6 pack starting at $34.90.
10% Off On Any Order Coupon Code
Recieve 10% off on all orders of $68 and more. [ATEM]
Upto 20% Off On Order Voucher
Enjoy upto 20% off on any selected lens and frames.
20% Off Quicklens.co.nz Promo Code
Take 20% discount on order selected lenses. [NATW]
Enjoy 15% Off Coupon Code
Receive 15% discount on selected frames. [NAFI]
Enjoy 15% Off Coupon Code 2020
15% off on all orders $120 and over. [MDWR]