Skip to content

Commit 4da5129

Browse files
authored
Fix indentation, add output in documentation
1 parent a008d55 commit 4da5129

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

docs/source/ffi/calling-idris-from-java.rst

+18-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Exporting Idris Functions
1717
"returnType": "String"
1818
}
1919
"""
20-
exportStringReplicate :Nat -> Char -> String
20+
exportStringReplicate : Nat -> Char -> String
2121
exportStringReplicate = String.replicate
2222
2323
This code exports ``replicate`` function from ``Data.String`` Idris module. The export block starting with ``%export``
@@ -87,7 +87,7 @@ integers which Java code shouldn't rely on.
8787
idris/data/List
8888
helloworld/Color
8989
"""
90-
typeExports: List String
90+
typeExports : List String
9191
typeExports = []
9292
9393
Similar to ``jvmExports`` block explained above, ``typeExports`` is a special export function that exports Idris types
@@ -112,7 +112,7 @@ Exporting Idris functions with Generic Types
112112
jvm:export
113113
IdrisList
114114
"""
115-
typeExports: List String
115+
typeExports : List String
116116
typeExports = []
117117
118118
%export """
@@ -239,7 +239,7 @@ Here is a complete example in Idris and Java:
239239
Show
240240
Color
241241
"""
242-
typeExports: List String
242+
typeExports : List String
243243
typeExports = []
244244
245245
%export """
@@ -462,6 +462,20 @@ Java calling the Idris functions:
462462
463463
}
464464
465+
This is the output:
466+
467+
.. code-block:: text
468+
469+
[23, 45]
470+
["foo", "bar"]
471+
[Red, Blue]
472+
Green
473+
Blue
474+
Just Green
475+
Nothing
476+
AAAAAAAAAA
477+
478+
465479
Here line numbers 29-33 retrieve type class instances for different types and the instances are passed in the lines
466480
below when ``show`` function is called. Another thing to note here is that when we call generic Idris functions, Idris
467481
types that are wrapped in Java types needs to be converted before passing to Idris functions. For example, line 23

0 commit comments

Comments
 (0)