Skip to content

Commit 8c36f2d

Browse files
authored
Merge pull request #23 from MarioAriasC/1.0.0-beta
1.0.0 beta
2 parents 093b645 + 0f17f03 commit 8c36f2d

File tree

68 files changed

+2691
-460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2691
-460
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.idea/*
22
*.iml
33
target/*
4+
*/target/*
45
*.kte
5-
*.log
6+
*.log
7+
*/dependency-reduced-pom.xml

README.md

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,35 @@ funKTionale
33

44
Functional constructs and patterns for [Kotlin](http://kotlin-lang.org)
55

6-
Features include:
7-
* Function composition
8-
* Currying
9-
* Partial Application
10-
* Option
11-
* Either/Disjunction
12-
* Memoization
13-
* Validation
14-
* And others
6+
## Modules
7+
8+
| Module | Description | Internal Dependencies | Artifact | Size(KB) |
9+
|---|---|---|---|---|
10+
|All| GOTY edition. Every other module content is included but not Experimental module|N/A|`funktionale-all`|1328|
11+
|Collections|Collections related extensions such as `tail`, `prependTo` and others|N/A|`funkationale-collections`|4|
12+
|Complement|Extension functions for predicates to generate complement functions|N/A|`funktionale-complement`|36|
13+
|Composition| Extensions `andThen` (`forwardCompose`) and `compose` for functions|N/A|`funktionale-composition`|8|
14+
|Currying|Extension `curried` and `uncurried` for functions|N/A|`funktionale-currying`|348|
15+
|Either|Either and Disjuntion (right-biased Either) types|Option|`funktionale-either`|44|
16+
|Experimental|Playground and examples. **Not to be used on production**|All|`funktionale-experimental`|148|
17+
|Memoization|Memoization for functions|N/A|`funktionale-memoization`|112|
18+
|Option|Option type|Collections and Utils|`funktionale-option`|20|
19+
|Pairing|Transformations for functions with arity 2 or 3 to one parameter of type `Pair` or `Triple` respectively |N/A|`funktionale-pairing`|8|
20+
|Partials|Partial applied functions|N/A|`funktionale-partials`|688|
21+
|Reverse|Extension `reverse` for functions|N/A|`funktionale-reverse`|32|
22+
|Try|Try computation type|Either|`funktionale-try`|12|
23+
|Utils|`identity` and `constant` functions and Partial Functions |N/A|`funktionale-complement`|20|
24+
|Validation|Validation types and functions with Disjunctions|Either|`funktionale-validation`|12|
1525

1626
## Documentation
1727

1828
Read the [Wiki](https://github.com/MarioAriasC/funKTionale/wiki)
1929

20-
Functional Programming in Kotlin with funKTionale [presentation](https://speakerdeck.com/marioariasc/functional-programming-in-kotlin-with-funktionale-1)
30+
Functional Programming in Kotlin with funKTionale ([video](https://www.youtube.com/watch?v=klakgWp1KWg), [presentation](https://speakerdeck.com/marioariasc/functional-programming-in-kotlin-with-funktionale-2))
2131

22-
## Maven
32+
## Maven (and Gradle)
2333

24-
You must configure your ```pom.xml``` file using JCenter repository
34+
You must configure your `pom.xml` file using JCenter repository
2535

2636
```xml
2737
<repository>
@@ -31,14 +41,18 @@ You must configure your ```pom.xml``` file using JCenter repository
3141
</repository>
3242
```
3343

34-
Then you can use funKTionale dependency
44+
Then you can use any funKTionale module to your library
3545

3646
```xml
3747
<dependency>
3848
<groupId>org.funktionale</groupId>
39-
<artifactId>funktionale</artifactId>
40-
<version>0.9.7</version>
49+
<artifactId>funktionale-all</artifactId>
50+
<version>${funktionale.version}</version>
4151
</dependency>
4252
```
4353

54+
## How to contribute?
55+
56+
Rise your PR against Experimental module (`funktionale-experimental`). Once it gets approved I'll move it to a proper module
57+
4458

funktionale-all/pom.xml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2013 - 2016 Mario Arias
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xmlns="http://maven.apache.org/POM/4.0.0"
20+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21+
<parent>
22+
<artifactId>funktionale</artifactId>
23+
<groupId>org.funktionale</groupId>
24+
<version>1.0.0-beta</version>
25+
</parent>
26+
<modelVersion>4.0.0</modelVersion>
27+
<name>GOTY Edition</name>
28+
<artifactId>funktionale-all</artifactId>
29+
<dependencies>
30+
<dependency>
31+
<groupId>org.funktionale</groupId>
32+
<artifactId>funktionale-collections</artifactId>
33+
<version>1.0.0-beta</version>
34+
</dependency>
35+
<dependency>
36+
<groupId>org.funktionale</groupId>
37+
<artifactId>funktionale-complement</artifactId>
38+
<version>1.0.0-beta</version>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.funktionale</groupId>
42+
<artifactId>funktionale-composition</artifactId>
43+
<version>1.0.0-beta</version>
44+
</dependency>
45+
<dependency>
46+
<groupId>org.funktionale</groupId>
47+
<artifactId>funktionale-currying</artifactId>
48+
<version>1.0.0-beta</version>
49+
</dependency>
50+
<dependency>
51+
<groupId>org.funktionale</groupId>
52+
<artifactId>funktionale-memoization</artifactId>
53+
<version>1.0.0-beta</version>
54+
</dependency>
55+
<dependency>
56+
<groupId>org.funktionale</groupId>
57+
<artifactId>funktionale-pairing</artifactId>
58+
<version>1.0.0-beta</version>
59+
</dependency>
60+
<dependency>
61+
<groupId>org.funktionale</groupId>
62+
<artifactId>funktionale-partials</artifactId>
63+
<version>1.0.0-beta</version>
64+
</dependency>
65+
<dependency>
66+
<groupId>org.funktionale</groupId>
67+
<artifactId>funktionale-reverse</artifactId>
68+
<version>1.0.0-beta</version>
69+
</dependency>
70+
<dependency>
71+
<groupId>org.funktionale</groupId>
72+
<artifactId>funktionale-utils</artifactId>
73+
<version>1.0.0-beta</version>
74+
</dependency>
75+
<dependency>
76+
<groupId>org.funktionale</groupId>
77+
<artifactId>funktionale-option</artifactId>
78+
<version>1.0.0-beta</version>
79+
</dependency>
80+
<dependency>
81+
<groupId>org.funktionale</groupId>
82+
<artifactId>funktionale-either</artifactId>
83+
<version>1.0.0-beta</version>
84+
</dependency>
85+
<dependency>
86+
<groupId>org.funktionale</groupId>
87+
<artifactId>funktionale-validation</artifactId>
88+
<version>1.0.0-beta</version>
89+
</dependency>
90+
<dependency>
91+
<groupId>org.funktionale</groupId>
92+
<artifactId>funktionale-try</artifactId>
93+
<version>1.0.0-beta</version>
94+
</dependency>
95+
</dependencies>
96+
<build>
97+
<plugins>
98+
<plugin>
99+
<groupId>org.apache.maven.plugins</groupId>
100+
<artifactId>maven-source-plugin</artifactId>
101+
</plugin>
102+
<plugin>
103+
<groupId>org.apache.maven.plugins</groupId>
104+
<artifactId>maven-gpg-plugin</artifactId>
105+
</plugin>
106+
<plugin>
107+
<groupId>org.apache.maven.plugins</groupId>
108+
<artifactId>maven-shade-plugin</artifactId>
109+
<version>2.4.3</version>
110+
<executions>
111+
<execution>
112+
<phase>package</phase>
113+
<goals>
114+
<goal>shade</goal>
115+
</goals>
116+
<configuration>
117+
<artifactSet>
118+
<excludes>
119+
<exclude>org.jetbrains.kotlin:*</exclude>
120+
</excludes>
121+
</artifactSet>
122+
</configuration>
123+
</execution>
124+
</executions>
125+
</plugin>
126+
</plugins>
127+
</build>
128+
</project>

funktionale-collections/pom.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2013 - 2016 Mario Arias
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xmlns="http://maven.apache.org/POM/4.0.0"
20+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21+
<parent>
22+
<artifactId>funktionale</artifactId>
23+
<groupId>org.funktionale</groupId>
24+
<version>1.0.0-beta</version>
25+
</parent>
26+
<modelVersion>4.0.0</modelVersion>
27+
<name>Collections Module</name>
28+
<artifactId>funktionale-collections</artifactId>
29+
<packaging>jar</packaging>
30+
<version>1.0.0-beta</version>
31+
<build>
32+
<sourceDirectory>src/main/kotlin</sourceDirectory>
33+
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
34+
<plugins>
35+
<plugin>
36+
<artifactId>kotlin-maven-plugin</artifactId>
37+
<groupId>org.jetbrains.kotlin</groupId>
38+
</plugin>
39+
<plugin>
40+
<groupId>org.apache.maven.plugins</groupId>
41+
<artifactId>maven-source-plugin</artifactId>
42+
</plugin>
43+
<plugin>
44+
<groupId>org.apache.maven.plugins</groupId>
45+
<artifactId>maven-gpg-plugin</artifactId>
46+
</plugin>
47+
</plugins>
48+
</build>
49+
</project>

src/main/kotlin/org/funktionale/collections/namespace.kt renamed to funktionale-collections/src/main/kotlin/org/funktionale/collections/namespace.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013 Mario Arias
2+
* Copyright 2013 - 2016 Mario Arias
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,16 +17,10 @@
1717
package org.funktionale.collections
1818

1919
/**
20-
* Created by IntelliJ IDEA.
21-
* @author Mario Arias
22-
* Date: 5/07/15
23-
* Time: 11:59 PM
20+
* Returns a list containing all elements except the first element
2421
*/
25-
26-
2722
fun <T> List<T>.tail(): List<T> = this.drop(1)
2823

2924
infix fun <T> T.prependTo(list: List<T>): List<T> = listOf(this) + list
3025

3126
fun <T> List<T>.destructured(): Pair<T, List<T>> = first() to tail()
32-

src/test/kotlin/org/funktionale/collections/CollectionsTest.kt renamed to funktionale-collections/src/test/kotlin/org/funktionale/collections/CollectionsTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013 Mario Arias
2+
* Copyright 2013 - 2016 Mario Arias
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

funktionale-complement/pom.xml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2013 - 2016 Mario Arias
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xmlns="http://maven.apache.org/POM/4.0.0"
20+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21+
<parent>
22+
<artifactId>funktionale</artifactId>
23+
<groupId>org.funktionale</groupId>
24+
<version>1.0.0-beta</version>
25+
</parent>
26+
<modelVersion>4.0.0</modelVersion>
27+
<name>Complement Module</name>
28+
<artifactId>funktionale-complement</artifactId>
29+
<packaging>jar</packaging>
30+
<version>1.0.0-beta</version>
31+
<build>
32+
<sourceDirectory>src/main/kotlin</sourceDirectory>
33+
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
34+
<plugins>
35+
<plugin>
36+
<artifactId>kotlin-maven-plugin</artifactId>
37+
<groupId>org.jetbrains.kotlin</groupId>
38+
</plugin>
39+
<plugin>
40+
<groupId>org.apache.maven.plugins</groupId>
41+
<artifactId>maven-source-plugin</artifactId>
42+
</plugin>
43+
<plugin>
44+
<groupId>org.apache.maven.plugins</groupId>
45+
<artifactId>maven-gpg-plugin</artifactId>
46+
</plugin>
47+
</plugins>
48+
</build>
49+
50+
</project>

src/main/kotlin/org/funktionale/complement/namespace.kt renamed to funktionale-complement/src/main/kotlin/org/funktionale/complement/namespace.kt

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/*
2-
Copyright 2016 Joel Whittaker-Smith
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
2+
* Copyright 2013 - 2016 Mario Arias
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
1616

1717
package org.funktionale.complement
1818

@@ -106,6 +106,4 @@ fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17,
106106

107107
fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22> Function22<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22, Boolean>.complement(): (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22) -> Boolean {
108108
return { p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12, p13: P13, p14: P14, p15: P15, p16: P16, p17: P17, p18: P18, p19: P19, p20: P20, p21: P21, p22: P22 -> !this(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22) }
109-
}
110-
111-
109+
}

0 commit comments

Comments
 (0)