summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-30 20:06:15 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-30 20:08:01 -0400
commit8f4fdb3f9782fd39e48cb0a6d3e82866b9b1a976 (patch)
tree12bd96c3d3b47b203f0fac44977a558b183cb13a
parent5287d1dc3f293b6eb7f6759fe9f25be1ad85fbae (diff)
parent85f1f3a63a025204e931959ec9c5ae2a7812ddff (diff)
Merge branch 'new-monad-control'
Conflicts: debian/changelog
-rw-r--r--Annex.hs17
-rw-r--r--Annex/Exception.hs6
-rw-r--r--debian/changelog5
-rw-r--r--debian/control3
-rw-r--r--doc/install.mdwn1
-rw-r--r--doc/todo/Please_add_support_for_monad-control_0.3.x.mdwn2
-rw-r--r--git-annex.cabal4
7 files changed, 27 insertions, 11 deletions
diff --git a/Annex.hs b/Annex.hs
index e82ffc5d1..8f8936937 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -5,7 +5,7 @@
- Licensed under the GNU GPL version 3 or higher.
-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving, TypeFamilies, MultiParamTypeClasses #-}
module Annex (
Annex,
@@ -22,8 +22,9 @@ module Annex (
fromRepo,
) where
-import Control.Monad.IO.Control
import Control.Monad.State
+import Control.Monad.Trans.Control (StM, MonadBaseControl, liftBaseWith, restoreM)
+import Control.Monad.Base (liftBase, MonadBase)
import Common
import qualified Git
@@ -45,12 +46,22 @@ newtype Annex a = Annex { runAnnex :: StateT AnnexState IO a }
deriving (
Monad,
MonadIO,
- MonadControlIO,
MonadState AnnexState,
Functor,
Applicative
)
+instance MonadBase IO Annex where
+ liftBase = Annex . liftBase
+
+instance MonadBaseControl IO Annex where
+ newtype StM Annex a = StAnnex (StM (StateT AnnexState IO) a)
+ liftBaseWith f = Annex $ liftBaseWith $ \runInIO ->
+ f $ liftM StAnnex . runInIO . runAnnex
+ restoreM = Annex . restoreM . unStAnnex
+ where
+ unStAnnex (StAnnex st) = st
+
data OutputType = NormalOutput | QuietOutput | JSONOutput
-- internal state storage
diff --git a/Annex/Exception.hs b/Annex/Exception.hs
index c147439a1..cb36d1bdb 100644
--- a/Annex/Exception.hs
+++ b/Annex/Exception.hs
@@ -11,8 +11,8 @@ module Annex.Exception (
throw,
) where
-import Control.Exception.Control (handle)
-import Control.Monad.IO.Control (liftIOOp)
+import Control.Exception.Lifted (handle)
+import Control.Monad.Trans.Control (liftBaseOp)
import Control.Exception hiding (handle, throw)
import Common.Annex
@@ -20,7 +20,7 @@ import Common.Annex
{- Runs an Annex action, with setup and cleanup both in the IO monad. -}
bracketIO :: IO c -> (c -> IO b) -> Annex a -> Annex a
bracketIO setup cleanup go =
- liftIOOp (Control.Exception.bracket setup cleanup) (const go)
+ liftBaseOp (Control.Exception.bracket setup cleanup) (const go)
{- Throws an exception in the Annex monad. -}
throw :: Control.Exception.Exception e => e -> Annex a
diff --git a/debian/changelog b/debian/changelog
index bbed54765..f3e830c01 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,13 +8,14 @@ git-annex (3.20111212) UNRELEASED; urgency=low
* Test suite improvements. Current top-level test coverage: 75%
* Improve deletion of files from rsync special remotes. Closes: #652849
* Add --include, which is the same as --not --exclude.
- * Can now be built with older git versions (before 1.7.7); the resulting
- binary should only be used with old git.
* Format strings can be specified using the new --format option, to control
what is output by git annex find.
* Support git annex find --json
* Fixed behavior when multiple insteadOf configs are provided for the
same url base.
+ * Can now be built with older git versions (before 1.7.7); the resulting
+ binary should only be used with old git.
+ * Updated to build with monad-control 0.3.
-- Joey Hess <joeyh@debian.org> Mon, 12 Dec 2011 01:57:49 -0400
diff --git a/debian/control b/debian/control
index 6f59ada5b..3f88c71ea 100644
--- a/debian/control
+++ b/debian/control
@@ -13,7 +13,8 @@ Build-Depends:
libghc-utf8-string-dev,
libghc-hs3-dev (>= 0.5.6),
libghc-testpack-dev [any-i386 any-amd64],
- libghc-monad-control-dev,
+ libghc-monad-control-dev (>= 0.3),
+ libghc-lifted-base-dev,
libghc-json-dev,
ikiwiki,
perlmagick,
diff --git a/doc/install.mdwn b/doc/install.mdwn
index cc26ee91d..ceaa3544f 100644
--- a/doc/install.mdwn
+++ b/doc/install.mdwn
@@ -25,6 +25,7 @@ To build and use git-annex, you will need:
* [SHA](http://hackage.haskell.org/package/SHA)
* [dataenc](http://hackage.haskell.org/package/dataenc)
* [monad-control](http://hackage.haskell.org/package/monad-control)
+ * [lifted-base](http://hackage.haskell.org/package/lifted-base)
* [TestPack](http://hackage.haskell.org/cgi-bin/hackage-scripts/package/testpack)
* [QuickCheck 2](http://hackage.haskell.org/package/QuickCheck)
* [HTTP](http://hackage.haskell.org/package/HTTP)
diff --git a/doc/todo/Please_add_support_for_monad-control_0.3.x.mdwn b/doc/todo/Please_add_support_for_monad-control_0.3.x.mdwn
index ca68c2c91..f82224991 100644
--- a/doc/todo/Please_add_support_for_monad-control_0.3.x.mdwn
+++ b/doc/todo/Please_add_support_for_monad-control_0.3.x.mdwn
@@ -5,3 +5,5 @@ Git-annex doesn't compile with the latest version of monad-control. Would it be
>
> There is now a branch in git called `new-monad-control` that will build
> with the new monad-control. --[[Joey]]
+
+>> Now merged to master. [[done]] --[[Joey]]
diff --git a/git-annex.cabal b/git-annex.cabal
index ae6a129b3..a0980b1f0 100644
--- a/git-annex.cabal
+++ b/git-annex.cabal
@@ -30,8 +30,8 @@ Executable git-annex
Main-Is: git-annex.hs
Build-Depends: MissingH, hslogger, directory, filepath,
unix, containers, utf8-string, network, mtl, bytestring, old-locale, time,
- pcre-light, extensible-exceptions, dataenc, SHA, process, hS3, HTTP,
- base < 5, monad-control < 0.3, json
+ pcre-light, extensible-exceptions, dataenc, SHA, process, hS3, json, HTTP,
+ base < 5, monad-control, transformers-base, lifted-base
Executable git-annex-shell
Main-Is: git-annex-shell.hs