Skip to content

Commit 3111db6

Browse files
authored
Move English version into /en subdirectory (#61)
1 parent ea798eb commit 3111db6

17 files changed

+28
-28
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ idea {
5555
}
5656

5757
asciidoctor {
58-
sourceDir = file('src/docs/asciidoc')
58+
sourceDir = file('src/docs/asciidoc/en')
5959
outputDir = file("$buildDir/docs/asciidoc")
6060

6161
options backend: 'html5'

src/docs/asciidoc/index.adoc renamed to src/docs/asciidoc/en/index.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
= Vavr User Guide
2-
Daniel Dietrich, Robert Winkler
2+
Daniel Dietrich, Robert Winkler, Grzegorz Piwowarek
33
:toc: left
44
:toclevels: 3
55
:source-highlighter: coderay
File renamed without changes.

src/docs/asciidoc/usage_guide.adoc renamed to src/docs/asciidoc/en/usage_guide.adoc

+26-26
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Here is an example of how to create a tuple holding a String and an Integer:
1515

1616
[source,java,indent=0]
1717
----
18-
include::../../test/java/io/vavr/TupleDemo.java[tags=createTuple]
18+
include::../../../test/java/io/vavr/TupleDemo.java[tags=createTuple]
1919
----
2020
<1> A tuple is created via the static factory method `Tuple.of()`
2121
<2> Get the 1st element of this tuple.
@@ -27,7 +27,7 @@ The component-wise map evaluates a function per element in the tuple, returning
2727

2828
[source,java,indent=0]
2929
----
30-
include::../../test/java/io/vavr/TupleDemo.java[tags=bimapTuple]
30+
include::../../../test/java/io/vavr/TupleDemo.java[tags=bimapTuple]
3131
----
3232

3333
==== Map a tuple using one mapper
@@ -36,7 +36,7 @@ It is also possible to map a tuple using one mapping function.
3636

3737
[source,java,indent=0]
3838
----
39-
include::../../test/java/io/vavr/TupleDemo.java[tags=mapTuple]
39+
include::../../../test/java/io/vavr/TupleDemo.java[tags=mapTuple]
4040
----
4141

4242
==== Transform a tuple
@@ -45,7 +45,7 @@ Transform creates a new type based on the tuple's contents.
4545

4646
[source,java,indent=0]
4747
----
48-
include::../../test/java/io/vavr/TupleDemo.java[tags=transformTuple]
48+
include::../../../test/java/io/vavr/TupleDemo.java[tags=transformTuple]
4949
----
5050

5151
=== Functions
@@ -55,21 +55,21 @@ The following lambda expression creates a function to sum two integers:
5555

5656
[source,java,indent=0]
5757
----
58-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=createFunctionWithLambda]
58+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=createFunctionWithLambda]
5959
----
6060

6161
This is a shorthand for the following anonymous class definition:
6262

6363
[source,java,indent=0]
6464
----
65-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=createFunctionWithAnonymousClass]
65+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=createFunctionWithAnonymousClass]
6666
----
6767

6868
You can also use the static factory method `Function3.of(...)` to a create a function from any method reference.
6969

7070
[source,java,indent=0]
7171
----
72-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=createFunctionWithFactoryMethod]
72+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=createFunctionWithFactoryMethod]
7373
----
7474

7575
In fact Vavr functional interfaces are Java 8 functional interfaces on steroids. They also provide features like:
@@ -85,14 +85,14 @@ You can use either `andThen`:
8585

8686
[source,java,indent=0]
8787
----
88-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=composeFunctions1]
88+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=composeFunctions1]
8989
----
9090

9191
or `compose`:
9292

9393
[source,java,indent=0]
9494
----
95-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=composeFunctions2]
95+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=composeFunctions2]
9696
----
9797

9898
==== Lifting
@@ -102,14 +102,14 @@ The following method `divide` is a partial function that only accepts non-zero d
102102

103103
[source,java,indent=0]
104104
----
105-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=partialDivideFunction]
105+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=partialDivideFunction]
106106
----
107107

108108
We use `lift` to turn `divide` into a total function that is defined for all inputs.
109109

110110
[source,java,indent=0]
111111
----
112-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=liftedDivideFunction]
112+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=liftedDivideFunction]
113113
----
114114

115115
<1> A lifted function returns `None` instead of throwing an exception, if the function is invoked with disallowed input values.
@@ -119,15 +119,15 @@ The following method `sum` is a partial function that only accepts positive inpu
119119

120120
[source,java,indent=0]
121121
----
122-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=partialFunctionExample]
122+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=partialFunctionExample]
123123
----
124124
<1> The function `sum` throws an `IllegalArgumentException` for negative input values.
125125

126126
We may lift the `sum` method by providing the methods reference.
127127

128128
[source,java,indent=0]
129129
----
130-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=liftMethodReference]
130+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=liftMethodReference]
131131
----
132132
<1> The lifted function catches the `IllegalArgumentException` and maps it to `None`.
133133

@@ -136,14 +136,14 @@ Partial application allows you to derive a new function from an existing one by
136136

137137
[source,java,indent=0]
138138
----
139-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=partialApplicationFunction]
139+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=partialApplicationFunction]
140140
----
141141
<1> The first parameter `a` is fixed to the value 2.
142142

143143
This can be demonstrated by fixing the first three parameters of a `Function5`, resulting in a `Function2`.
144144
[source,java,indent=0]
145145
----
146-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=partialApplicationFunctionArity5]
146+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=partialApplicationFunctionArity5]
147147
----
148148
<1> The `a`, `b` and `c` parameters are fixed to the values 2, 3 and 1 respectively.
149149

@@ -156,15 +156,15 @@ When a `Function2` is _curried_, the result is indistinguishable from the _parti
156156

157157
[source,java,indent=0]
158158
----
159-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=curryingFunction]
159+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=curryingFunction]
160160
----
161161
<1> The first parameter `a` is fixed to the value 2.
162162

163163
You might notice that, apart from the use of `.curried()`, this code is identical to the 2-arity given example in <<Partial application>>. With higher-arity functions, the difference becomes clear.
164164

165165
[source,java,indent=0]
166166
----
167-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=curryingFunctionArity3]
167+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=curryingFunctionArity3]
168168
----
169169
<1> Note the presence of additional functions in the parameters.
170170
<2> Further calls to `apply` returns another `Function1`, apart from the final call.
@@ -175,7 +175,7 @@ The following example calculates a random number on the first invocation and ret
175175

176176
[source,java,indent=0]
177177
----
178-
include::../../test/java/io/vavr/FunctionsDemo.java[tags=memoizedFunction]
178+
include::../../../test/java/io/vavr/FunctionsDemo.java[tags=memoizedFunction]
179179
----
180180

181181
=== Values
@@ -197,7 +197,7 @@ Using `Optional`, this scenario is valid.
197197

198198
[source,java,indent=0]
199199
----
200-
include::../../test/java/io/vavr/OptionDemo.java[tags=javaOptionalWithMappedNull]
200+
include::../../../test/java/io/vavr/OptionDemo.java[tags=javaOptionalWithMappedNull]
201201
----
202202
<1> The option is `Some("foo")`
203203
<2> The resulting option becomes empty here
@@ -206,7 +206,7 @@ Using Vavr's `Option`, the same scenario will result in a `NullPointerException`
206206

207207
[source,java,indent=0]
208208
----
209-
include::../../test/java/io/vavr/OptionDemo.java[tags=vavrOptionWithMappedNull]
209+
include::../../../test/java/io/vavr/OptionDemo.java[tags=vavrOptionWithMappedNull]
210210
----
211211
<1> The option is `Some("foo")`
212212
<2> The resulting option is `Some(null)`
@@ -218,7 +218,7 @@ This may seem to make `Option` useless, but it actually forces you to pay attent
218218

219219
[source,java,indent=0]
220220
----
221-
include::../../test/java/io/vavr/OptionDemo.java[tags=flatMapNullParameter]
221+
include::../../../test/java/io/vavr/OptionDemo.java[tags=flatMapNullParameter]
222222
----
223223
<1> The option is `Some("foo")`
224224
<2> The resulting option is `Some(null)`
@@ -228,7 +228,7 @@ Alternatively, move the `.flatMap` to be co-located with the the possibly `null`
228228

229229
[source,java,indent=0]
230230
----
231-
include::../../test/java/io/vavr/OptionDemo.java[tags=mapOptionParameter]
231+
include::../../../test/java/io/vavr/OptionDemo.java[tags=mapOptionParameter]
232232
----
233233
<1> The option is `Some("foo")`
234234
<2> The resulting option is `None`
@@ -263,7 +263,7 @@ Lazy is a monadic container type which represents a lazy evaluated value. Compar
263263

264264
[source,java,indent=0]
265265
----
266-
include::../../test/java/io/vavr/LazyDemo.java[tags=createLazy]
266+
include::../../../test/java/io/vavr/LazyDemo.java[tags=createLazy]
267267
----
268268

269269
You may also create a real lazy value (works only with interfaces):
@@ -310,21 +310,21 @@ Example: We get the fields 'name' and 'age' from a web form and want to create e
310310

311311
[source,java,indent=0]
312312
----
313-
include::../../test/java/io/vavr/ValidationDemo.java[tags=validatePerson]
313+
include::../../../test/java/io/vavr/ValidationDemo.java[tags=validatePerson]
314314
----
315315

316316
A valid value is contained in a `Validation.Valid` instance, a list of validation errors is contained in a `Validation.Invalid` instance.
317317

318318
The following validator is used to combine different validation results to one `Validation` instance.
319319

320320
----
321-
include::../../test/java/io/vavr/ValidationDemo.java[tags=personValidator]
321+
include::../../../test/java/io/vavr/ValidationDemo.java[tags=personValidator]
322322
----
323323

324324
If the validation succeeds, i.e. the input data is valid, then an instance of `Person` is created of the given fields `name` and `age`.
325325

326326
----
327-
include::../../test/java/io/vavr/ValidationDemo.java[tags=person]
327+
include::../../../test/java/io/vavr/ValidationDemo.java[tags=person]
328328
----
329329

330330
=== Collections

0 commit comments

Comments
 (0)