Skip to content

Commit

Permalink
Grammar suggestions
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
  • Loading branch information
mniip and RyanGlScott committed Dec 10, 2023
1 parent a79c4cf commit a9443f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions fast/Data/Reflection.hs
Expand Up @@ -592,14 +592,14 @@ instance Reifies (StableBox w0 w1 a) (Box b) => Reifies (Stable w0 w1 a) b where
reflect p = case reflect (stableBox p) of
Box a -> a

-- Ensure that exactly one dictionary of Reifies (StableBox ...) is created and evaluated per a reifyTypeable call.
-- Ensure that exactly one dictionary of Reifies (StableBox ...) is created and evaluated per reifyTypeable call.
--
-- Evaluating the dictionary's thunk frees the allocated StablePtr, and the contents of the StablePtr replace the thunk.
-- Creating two dictionaries would mean a double free upon their evaluation, and leaving a dictionary unevaluated would
-- leak the StablePtr (see https://github.com/ekmett/reflection/issues/54 ).
-- leak the StablePtr (see https://github.com/ekmett/reflection/issues/54).
--
-- To separate evaluation of the dictionary and evaluation of the actual argument passed to reifyTypeable, we insert a
-- Box inbetween.
-- Box in between.
withStableBox :: Reifies (StableBox w0 w1 a) (Box a) => (Reifies (Stable w0 w1 a) a => Proxy (Stable w0 w1 a) -> r) -> Proxy (Stable w0 w1 a) -> IO r
withStableBox k p = do
_ <- evaluate $ reflect (stableBox p)
Expand Down
6 changes: 3 additions & 3 deletions slow/Data/Reflection.hs
Expand Up @@ -193,16 +193,16 @@ instance Reifies (StableBox b0 b1 b2 b3 b4 b5 b6 b7 a) (Box b)
Box a -> a

-- Ensure that exactly one dictionary of Reifies (StableBox ...) is created and
-- evaluated per a reifyTypeable call.
-- evaluated per reifyTypeable call.
--
-- Evaluating the dictionary's thunk frees the allocated StablePtr, and the
-- contents of the StablePtr replace the thunk. Creating two dictionaries would
-- mean a double free upon their evaluation, and leaving a dictionary
-- unevaluated would leak the StablePtr
-- (see https://github.com/ekmett/reflection/issues/54 ).
-- (see https://github.com/ekmett/reflection/issues/54).
--
-- To separate evaluation of the dictionary and evaluation of the actual
-- argument passed to reifyTypeable, we insert a Box inbetween.
-- argument passed to reifyTypeable, we insert a Box in between.
withStableBox
:: Reifies (StableBox b0 b1 b2 b3 b4 b5 b6 b7 a) (Box a)
=> (Reifies (Stable b0 b1 b2 b3 b4 b5 b6 b7 a) a
Expand Down

0 comments on commit a9443f4

Please sign in to comment.