Skip to content

Commit 53f67c0

Browse files
fixup: documentation
1 parent eea90d1 commit 53f67c0

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

core/src/Streamly/Internal/Control/Exception.hs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ verifyM predicate = verify predicate (pure ())
7777

7878
-- | @AllocateIO f@ is a newtype wrapper for an IO monad allocator function @f@.
7979
--
80-
-- The allocator function @f alloc free@ is used in bracket style safe resource
81-
-- allocation functions, where @alloc@ is function used to allocate a resource
82-
-- and @free@ is used to free it. The allocator returns a tuple @(result,
83-
-- release)@ where @result@ is the allocated resource and @release@ is an
84-
-- action that can be called later to release the resource.
80+
-- The allocator function @f alloc free@ is used in bracket-style safe resource
81+
-- allocation functions, where @alloc@ is a function used to allocate a
82+
-- resource and @free@ is used to free it. The allocator returns a tuple
83+
-- @(resource, release)@ where @resource@ is the allocated resource and
84+
-- @release@ is an action that can be called later to release the resource.
8585
--
8686
newtype AllocateIO = AllocateIO
8787
(forall b c. IO b -> (b -> IO c) -> IO (b, IO ()))
@@ -108,13 +108,11 @@ newtype RegisterIO = RegisterIO (forall c. IO c -> IO ())
108108
-- resource manually at any time. @release@ is guaranteed to free the resource
109109
-- only once even if it is called concurrently or multiple times.
110110
--
111-
-- This function provides functionality similar to the bracket function
111+
-- This function provides functionality similar to the @bracket@ function
112112
-- available in the base library. However, it is more powerful as any number of
113113
-- resources can be allocated at any time within the scope and can be released
114114
-- at any time.
115115
--
116-
-- This function does not rely on GC for cleanup. Cleanup is deterministic.
117-
--
118116
-- Exception safe, thread safe.
119117
{-# INLINE withAllocateIO #-}
120118
withAllocateIO :: (MonadIO m, MonadMask m) => (AllocateIO -> m a) -> m a
@@ -156,15 +154,13 @@ allocToRegIO (AllocateIO f) = RegisterIO (void . g)
156154

157155
-- | @withRegisterIO action@ runs the given @action@, providing it with a
158156
-- special function called @register@ as argument. A @register hook@ call can
159-
-- be used within @action@ any number of times to register a hook that would
160-
-- run automatically when 'withAllocateIO' ends or if an exception occurs at
157+
-- be used within @action@ any number of times to register hooks that would
158+
-- run automatically when 'withRegisterIO' ends or if an exception occurs at
161159
-- any time.
162160
--
163-
-- This function provides functionality similar to the finally function
164-
-- available in the base library. However, it is more powerful as any number of
165-
-- hooks can be registered at any time within the scope of @withRegisterIO@.
166-
--
167-
-- This function does not rely on GC for executing the hooks.
161+
-- This function provides functionality similar to the @finally@ function
162+
-- available in the @base@ package. However, it is more powerful as any number
163+
-- of hooks can be registered at any time within the scope of @withRegisterIO@.
168164
--
169165
-- Exception safe, thread safe.
170166
{-# INLINE withRegisterIO #-}

0 commit comments

Comments
 (0)