com.codepoetics:klenses

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

GroupId

GroupId

com.codepoetics
ArtifactId

ArtifactId

klenses
Last Version

Last Version

0.4
Release Date

Release Date

Type

Type

pom
Description

Description

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Source Code Management

Source Code Management

http://github.com/poetix/klenses

Download klenses

Filename Size
klenses-0.4.pom 2 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/com.codepoetics/klenses/ -->
<dependency>
    <groupId>com.codepoetics</groupId>
    <artifactId>klenses</artifactId>
    <version>0.4</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.codepoetics/klenses/
implementation 'com.codepoetics:klenses:0.4'
// https://jarcasting.com/artifacts/com.codepoetics/klenses/
implementation ("com.codepoetics:klenses:0.4")
'com.codepoetics:klenses:pom:0.4'
<dependency org="com.codepoetics" name="klenses" rev="0.4">
  <artifact name="klenses" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.codepoetics', module='klenses', version='0.4')
)
libraryDependencies += "com.codepoetics" % "klenses" % "0.4"
[com.codepoetics/klenses "0.4"]

Dependencies

compile (2)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib jar 1.0.1-2
org.jetbrains.kotlin : kotlin-reflect jar 1.0.1-2

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

klenses

Lenses for Kotlin.

Maven Central Build Status

Lenses are property references with some extra abilities: they can also be used to create a copy of an object with the property set to a different value, and they compose to form pointers into nested objects.

data class Inner(val value: String)
data class Outer(val outerValue: String, val inner: Inner?)

val foo = Outer("foo", null)

val outerValueLens = +Outer::outerValue
val innerLens = Outer::inner orElse Inner("xyzzy")
val innerValueLens = innerLens + Inner::value 

assertEquals("foo", outerValueLens(foo))
assertEquals(Outer("quux", null), outerValueLens(foo, "quux"))
assertEquals(Inner("xyzzy"), innerLens(foo))
assertEquals(Outer("foo", Inner("frobnitz")), innerValueLens(foo, "frobnitz"))
assertEquals(Outer("foo", Inner("XYZZY")), innerValueLens(foo) { toUpperCase() })

Versions

Version
0.4
0.3
0.2