Skip to content

Commit

Permalink
feat: update Home.js with Java interop (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
magnus-madsen authored Aug 4, 2024
1 parent 142cf98 commit 91d902f
Showing 1 changed file with 44 additions and 3 deletions.
47 changes: 44 additions & 3 deletions src/page/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,16 @@ instance Coll[MutMap[k, v, r]] {
<CardTitle><h4>Associated Effects</h4></CardTitle>
<CardText>
<p>
Associated effects allow the effects in trait members to depend on the instance type.
This makes it easy to create abstractions over both pure and effectful operations,
Associated effects allow the effects in trait members to depend on the instance
type.
This makes it easy to create abstractions over both pure and effectful
operations,
and mutable and immutable data structures.
</p>

<p>
The code on the left adds an associated effect <code>Aef</code> to the <code>Coll</code> trait,
The code on the left adds an associated effect <code>Aef</code> to
the <code>Coll</code> trait,
which makes it possible to add instances for mutable collections.
</p>
</CardText>
Expand Down Expand Up @@ -643,6 +646,44 @@ def conn(u: String, p: String): Validation[Err, Connection] =
</Col>
</Row>

<Row className="mb-4">
<Col md="6">
<Card className="border-0">
<CardBody>
<CardTitle><h4>Seamless Java Interoperability</h4></CardTitle>
<CardText>
<p>
Flix supports seamless Java interoperability, making it possible to reuse code
from the Java Standard Library and the Java ecosystem, e.g., via Maven.
</p>
<p>
Java support includes object creation, method invocation, exceptions, and
class/interface extension.
</p>
</CardText>
</CardBody>
</Card>
</Col>
<Col md="6">
<InlineEditor>
{`import java.io.File
import java.io.FileWriter
import java.io.IOException
def main(): Unit \\ IO =
let f = new File("foo.txt");
try {
let w = new FileWriter(f);
w.append("Hello World\\n");
w.close()
} catch {
case ex: IOException =>
println("Unable to write file")
}`}
</InlineEditor>
</Col>
</Row>

<Row className="mb-4">
<Col md="12">
<Card className="border-0">
Expand Down

0 comments on commit 91d902f

Please sign in to comment.