@@ -103,12 +103,18 @@ data PreExistingRun m h =
103103 PreExistingRun ! (Ref (Run m h ))
104104 | PreExistingMergingRun ! (Ref (MergingRun MR. LevelMergeType m h ))
105105
106+ {-# SPECIALISE newCompletedMerge ::
107+ Ref (Run IO h)
108+ -> IO (Ref (MergingTree IO h)) #-}
106109newCompletedMerge ::
107110 (MonadMVar m , PrimMonad m , MonadMask m )
108111 => Ref (Run m h )
109112 -> m (Ref (MergingTree m h ))
110113newCompletedMerge run = mkMergingTree . CompletedTreeMerge =<< dupRef run
111114
115+ {-# SPECIALISE newOngoingMerge ::
116+ Ref (MergingRun MR.TreeMergeType IO h)
117+ -> IO (Ref (MergingTree IO h)) #-}
112118-- | Create a new 'MergingTree' representing the merge of an ongoing run.
113119-- The usage of this function is primarily to facilitate the reloading of an
114120-- ongoing merge from a persistent snapshot.
@@ -118,6 +124,10 @@ newOngoingMerge ::
118124 -> m (Ref (MergingTree m h ))
119125newOngoingMerge mr = mkMergingTree . OngoingTreeMerge =<< dupRef mr
120126
127+ {-# SPECIALISE newPendingLevelMerge ::
128+ [PreExistingRun IO h]
129+ -> Maybe (Ref (MergingTree IO h))
130+ -> IO (Ref (MergingTree IO h)) #-}
121131-- | Create a new 'MergingTree' representing the merge of a sequence of
122132-- pre-existing runs (completed or ongoing, plus a optional final tree).
123133-- This is for merging the entire contents of a table down to a single run
@@ -178,6 +188,9 @@ newPendingLevelMerge prs mmt = do
178188 then return Nothing
179189 else Just <$!> dupRef mt
180190
191+ {-# SPECIALISE newPendingUnionMerge ::
192+ [Ref (MergingTree IO h)]
193+ -> IO (Ref (MergingTree IO h)) #-}
181194-- | Create a new 'MergingTree' representing the union of one or more merging
182195-- trees. This is for unioning the content of multiple tables (represented
183196-- themselves as merging trees).
@@ -207,6 +220,7 @@ newPendingUnionMerge mts = do
207220 -> return mt
208221 _ -> mkMergingTree (PendingTreeMerge (PendingUnionMerge mts''))
209222
223+ {-# SPECIALISE isStructurallyEmpty :: Ref (MergingTree IO h) -> IO Bool #-}
210224-- | Test if a 'MergingTree' is \"obviously\" empty by virtue of its structure.
211225-- This is not the same as being empty due to a pending or ongoing merge
212226-- happening to produce an empty run.
@@ -221,6 +235,9 @@ isStructurallyEmpty (DeRef MergingTree {mergeState}) =
221235 -- It may also turn out to be useful to consider CompletedTreeMerge with
222236 -- a zero length runs as empty.
223237
238+ {-# SPECIALISE mkMergingTree ::
239+ MergingTreeState IO h
240+ -> IO (Ref (MergingTree IO h)) #-}
224241-- | Constructor helper.
225242--
226243-- This adopts the references in the MergingTreeState, so callers should
@@ -239,6 +256,7 @@ mkMergingTree mergeTreeState = do
239256 , mergeRefCounter
240257 }
241258
259+ {-# SPECIALISE finalise :: StrictMVar IO (MergingTreeState IO h) -> IO () #-}
242260finalise :: (MonadMVar m , PrimMonad m , MonadMask m )
243261 => StrictMVar m (MergingTreeState m h ) -> m ()
244262finalise mergeState = releaseMTS =<< readMVar mergeState
0 commit comments