summaryrefslogtreecommitdiff
path: root/Annex.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-30 20:38:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-30 20:38:59 -0400
commit252376d639ca6f24ad45f598bb70fdaa463c9f9e (patch)
treece93b99bf1df91a35e0b679dfaed26a2024c91f0 /Annex.hs
parentb538f45fafdf161c24f07562ac1bd73f1476ace9 (diff)
parent230bc8334bb7a947a61a0e213c51fca18decde1c (diff)
Merge branch 'master' into autosync
Diffstat (limited to 'Annex.hs')
-rw-r--r--Annex.hs17
1 files changed, 14 insertions, 3 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