summaryrefslogtreecommitdiff
path: root/CmdLine/GitAnnex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-09 16:20:30 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-09 16:20:30 -0400
commit7a5aff2c121f4ecbc173e939b0cf7b2975d18438 (patch)
treeb221d9a1c8093e2a97a1c5ccb623a704aabd94b5 /CmdLine/GitAnnex
parent525e04af35bb588b4f8a8721cfa77b2b285ac914 (diff)
refactor
Diffstat (limited to 'CmdLine/GitAnnex')
-rw-r--r--CmdLine/GitAnnex/Options.hs23
1 files changed, 1 insertions, 22 deletions
diff --git a/CmdLine/GitAnnex/Options.hs b/CmdLine/GitAnnex/Options.hs
index fb1b81acf..c027c602c 100644
--- a/CmdLine/GitAnnex/Options.hs
+++ b/CmdLine/GitAnnex/Options.hs
@@ -5,8 +5,6 @@
- Licensed under the GNU GPL version 3 or higher.
-}
-{-# LANGUAGE FlexibleInstances #-}
-
module CmdLine.GitAnnex.Options where
import System.Console.GetOpt
@@ -20,6 +18,7 @@ import Types.NumCopies
import Types.Messages
import Types.Key
import Types.Command
+import Types.DeferredParse
import qualified Annex
import qualified Remote
import qualified Limit
@@ -56,26 +55,6 @@ gitAnnexOptions = commonOptions ++
>>= pure . (\r -> r { gitGlobalOpts = gitGlobalOpts r ++ [Param "-c", Param v] })
>>= Annex.changeGitRepo
--- Some values cannot be fully parsed without performing an action.
--- The action may be expensive, so it's best to call finishParse on such a
--- value before using getParsed repeatedly.
-data DeferredParse a = DeferredParse (Annex a) | ReadyParse a
-
-class DeferredParseClass a where
- finishParse :: a -> Annex a
-
-getParsed :: DeferredParse a -> Annex a
-getParsed (DeferredParse a) = a
-getParsed (ReadyParse a) = pure a
-
-instance DeferredParseClass (DeferredParse a) where
- finishParse (DeferredParse a) = ReadyParse <$> a
- finishParse (ReadyParse a) = pure (ReadyParse a)
-
-instance DeferredParseClass (Maybe (DeferredParse a)) where
- finishParse Nothing = pure Nothing
- finishParse (Just v) = Just <$> finishParse v
-
parseRemoteOption :: Parser RemoteName -> Parser (DeferredParse Remote)
parseRemoteOption p = DeferredParse . (fromJust <$$> Remote.byNameWithUUID) . Just <$> p