Skip to content

Commit edf2178

Browse files
committed
re conduit deprecations: use ConduitT directly
Fixes some compile errors e.g.: ``` gitlib-libgit2> Expected: Maybe (Git.CommitOid LgRepo) gitlib-libgit2> -> Git.CommitOid LgRepo gitlib-libgit2> -> Bool gitlib-libgit2> -> ConduitT i (Git.ObjectOid LgRepo) m () gitlib-libgit2> Actual: Maybe CommitOid gitlib-libgit2> -> CommitOid -> Bool -> Producer m0 ObjectOid gitlib-libgit2> • In the expression: lgSourceObjects gitlib-libgit2> In an equation for ‘Git.sourceObjects’: gitlib-libgit2> Git.sourceObjects = lgSourceObjects gitlib-libgit2> In the instance declaration for ‘Git.MonadGit LgRepo m’ gitlib-libgit2> • Relevant bindings include gitlib-libgit2> sourceObjects :: Maybe (Git.CommitOid LgRepo) gitlib-libgit2> -> Git.CommitOid LgRepo gitlib-libgit2> -> Bool gitlib-libgit2> -> ConduitT i (Git.ObjectOid LgRepo) m () gitlib-libgit2> (bound at Git/Libgit2.hs:214:5) gitlib-libgit2> | gitlib-libgit2> 214 | sourceObjects = lgSourceObjects ```
1 parent 9370b9d commit edf2178

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

gitlib-cmdline/Git/CmdLine.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ cliExistsObject (shaToText -> sha) = do
372372

373373
cliSourceObjects :: MonadCli m
374374
=> Maybe (CommitOid CliRepo) -> CommitOid CliRepo -> Bool
375-
-> Producer (ReaderT CliRepo m) (ObjectOid CliRepo)
375+
-> ConduitT i (ObjectOid CliRepo) (ReaderT CliRepo m ())
376376
cliSourceObjects mhave need alsoTrees = do
377377
shas <- lift $ doRunGit run
378378
([ "--no-pager", "log", "--format=%H %T" ]
@@ -496,7 +496,7 @@ cliTreeEntry tree fp = do
496496

497497
cliSourceTreeEntries :: MonadCli m
498498
=> Tree CliRepo
499-
-> Producer (ReaderT CliRepo m) (TreeFilePath, TreeEntry CliRepo)
499+
-> ConduitT i (TreeFilePath, TreeEntry CliRepo) (ReaderT CliRepo m ())
500500
cliSourceTreeEntries tree = do
501501
contents <- lift $ do
502502
toid <- treeOid tree
@@ -633,7 +633,7 @@ cliUpdateRef refName (RefSymbolic targetName) =
633633
cliDeleteRef :: MonadCli m => Text -> ReaderT CliRepo m ()
634634
cliDeleteRef refName = runGit_ ["update-ref", "-d", fromStrict refName]
635635

636-
cliSourceRefs :: MonadCli m => Producer (ReaderT CliRepo m) Text
636+
cliSourceRefs :: MonadCli m => ConduitT i Text (ReaderT CliRepo m ())
637637
cliSourceRefs = do
638638
mxs <- lift $ cliShowRef Nothing
639639
yieldMany $ case mxs of

gitlib-hit/Git/Hit.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ hitWriteTree entMap = do
380380
fmap Tagged $ liftIO $ DGS.setObject g $ DGO.ObjTree $ DGT.Tree ents
381381

382382

383-
hitSourceRefs :: MonadHit m => Producer (ReaderT HitRepo m) Text
383+
hitSourceRefs :: MonadHit m => ConduitT i Text (ReaderT HitRepo m ())
384384
hitSourceRefs = do
385385
g <- lift $ hitGit <$> getRepository
386386
-- TODO: this produces branches & tags, but not remotes
@@ -394,7 +394,7 @@ hitSourceRefs = do
394394

395395
hitSourceTreeEntries :: MonadHit m
396396
=> Tree HitRepo
397-
-> Producer (ReaderT HitRepo m) TreePathEntry
397+
-> ConduitT i TreePathEntry (ReaderT HitRepo m ())
398398
hitSourceTreeEntries (HitTree oid) = do
399399
g <- lift $ hitGit <$> getRepository
400400
ents <- liftIO $ readTreeRecurse "" (untag oid) g

gitlib-libgit2/Git/Libgit2.hs

+8-9
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ import Control.Monad.Catch
6767
import Control.Monad.Loops
6868
import Control.Monad.Trans.Reader (ReaderT, runReaderT, ask)
6969
import Control.Monad.Trans.Resource
70-
import Control.Monad.IO.Unlift
7170
import Data.Bits ((.|.), (.&.))
7271
import Data.Bool (bool)
7372
import Data.ByteString (ByteString)
@@ -103,9 +102,8 @@ import Foreign.Storable
103102
import qualified Git
104103
import Git.Libgit2.Internal
105104
import Git.Libgit2.Types
106-
import Language.Haskell.TH.Syntax (Loc(..))
107105

108-
import Prelude hiding (mapM, mapM_, sequence, catch)
106+
import Prelude hiding (mapM, mapM_, sequence)
109107
import System.Directory
110108
import System.FilePath.Posix
111109
import System.IO (openBinaryTempFile, hClose)
@@ -351,7 +349,7 @@ lgTreeOid (LgTree (Just tree)) = liftIO $ do
351349
gatherFrom' :: (MonadExcept m, MonadUnliftIO m)
352350
=> Int -- ^ Size of the queue to create
353351
-> (TBQueue o -> m ()) -- ^ Action that generates output values
354-
-> Producer m o
352+
-> ConduitT i o m ()
355353
gatherFrom' size scatter = do
356354
chan <- liftIO $ newTBQueueIO (fromIntegral size)
357355
worker <- lift $ async (scatter chan)
@@ -371,7 +369,7 @@ gatherFrom' size scatter = do
371369
lgSourceTreeEntries
372370
:: (MonadLg m, HasLgRepo m)
373371
=> Tree
374-
-> Producer m (Git.TreeFilePath, TreeEntry)
372+
-> ConduitT i (Git.TreeFilePath, TreeEntry) m ()
375373
lgSourceTreeEntries (LgTree Nothing) = return ()
376374
lgSourceTreeEntries (LgTree (Just tree)) = gatherFrom' 16 $ \queue -> do
377375
liftIO $ withForeignPtr tree $ \tr -> do
@@ -708,7 +706,7 @@ lgForEachObject odbPtr f payload =
708706

709707
lgSourceObjects :: (MonadLg m, HasLgRepo m)
710708
=> Maybe CommitOid -> CommitOid -> Bool
711-
-> Producer m ObjectOid
709+
-> ConduitT i ObjectOid m ()
712710
lgSourceObjects mhave need alsoTrees = do
713711
repo <- lift getRepository
714712
walker <- liftIO $ alloca $ \pptr -> do
@@ -940,7 +938,7 @@ flagsToInt flags = (if listFlagOid flags then 1 else 0)
940938
+ (if listFlagHasPeel flags then 8 else 0)
941939

942940

943-
lgSourceRefs :: (MonadLg m, HasLgRepo m) => Producer m Git.RefName
941+
lgSourceRefs :: (MonadLg m, HasLgRepo m) => ConduitT i Git.RefName m ()
944942
lgSourceRefs =
945943
gatherFrom' 16 $ \queue -> do
946944
repo <- getRepository
@@ -1033,10 +1031,11 @@ lgThrow f = do
10331031

10341032
lgDiffContentsWithTree
10351033
:: MonadLg m
1036-
=> Source (ReaderT LgRepo m)
1034+
=> ConduitM ()
10371035
(Either Git.TreeFilePath (Either Git.SHA ByteString))
1036+
(ReaderT LgRepo m) ()
10381037
-> Tree
1039-
-> Producer (ReaderT LgRepo m) ByteString
1038+
-> ConduitT i ByteString (ReaderT LgRepo m) ()
10401039
lgDiffContentsWithTree _contents (LgTree Nothing) =
10411040
liftIO $ throwM $
10421041
Git.DiffTreeToIndexFailed "Cannot diff against an empty tree"

0 commit comments

Comments
 (0)