Skip to content

Commit cde66ae

Browse files
Reword conditions for reflect and reify once more.
1 parent 22feef9 commit cde66ae

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

jvm/CHANGELOG.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
2222
* The `Reify`/`Reflect` instances for `()` is now mapped to
2323
a *serializable* small JVM object. This is a more useful instance
2424
for sparkle users.
25-
* `Reify`/`Reflect` were given additional pre and post conditions.
26-
The lifetimes of the marshaled values are disentangled now, which
27-
fixes memory errors in the instances of `[J ty]`.
25+
* `Reify`/`Reflect` were given an additional invariant.
26+
The result and argument of `reflect` and `reify` shouldn't share any
27+
direct JVM object references. This fixes memory errors in the
28+
instances of `[J ty]`.
2829
[#102](https://github.com/tweag/inline-java/pull/102)
2930

3031
## [0.3.0] - 2017-08-31

jvm/src/Language/Java.hs

+4-4
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ class (SingI (Interp a), IsReferenceType (Interp a)) => Interpretation (a :: k)
469469
-- say, unmarshall a Java object to a Haskell value. Unlike coercing, in general
470470
-- reifying induces allocations and copies.
471471
class Interpretation a => Reify a where
472-
-- | Invariant: the argument and the result are distinct. That is, the result
473-
-- and the argument share no direct JVM object references.
472+
-- | Invariant: The result and the argument share no direct JVM object
473+
-- references.
474474
reify :: J (Interp a) -> IO a
475475

476476
default reify :: (Coercible a, Interp a ~ Ty a) => J (Interp a) -> IO a
@@ -480,8 +480,8 @@ class Interpretation a => Reify a where
480480
-- say, marshall a Haskell value to a Java object. Unlike coercing, in general
481481
-- reflection induces allocations and copies.
482482
class Interpretation a => Reflect a where
483-
-- | Invariant: the argument and the result are distinct. That is, the result
484-
-- and the argument share no direct JVM object references.
483+
-- | Invariant: The result and the argument share no direct JVM object
484+
-- references.
485485
reflect :: a -> IO (J (Interp a))
486486

487487
default reflect :: (Coercible a, Interp a ~ Ty a) => a -> IO (J (Interp a))

0 commit comments

Comments
 (0)