summaryrefslogtreecommitdiff
path: root/BackendUrl.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-13 21:28:47 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-13 21:28:47 -0400
commitb1607485168e851f69fe3a5b74d73f3c36edf886 (patch)
tree496133383a3aa77ecc373c383c6655e50d71f9c9 /BackendUrl.hs
parente5c1db355f5fa31af14ed8474aee89872b934f1a (diff)
use a state monad
enormous reworking
Diffstat (limited to 'BackendUrl.hs')
-rw-r--r--BackendUrl.hs21
1 files changed, 11 insertions, 10 deletions
diff --git a/BackendUrl.hs b/BackendUrl.hs
index 5b586497c..43b0bc75a 100644
--- a/BackendUrl.hs
+++ b/BackendUrl.hs
@@ -3,6 +3,7 @@
module BackendUrl (backend) where
+import Control.Monad.State
import System.Cmd
import IO
import Types
@@ -16,19 +17,19 @@ backend = Backend {
}
-- cannot generate url from filename
-keyValue :: State -> FilePath -> IO (Maybe Key)
-keyValue repo file = return Nothing
+keyValue :: FilePath -> Annex (Maybe Key)
+keyValue file = return Nothing
-- cannot change url contents
-dummyStore :: State -> FilePath -> Key -> IO Bool
-dummyStore repo file url = return False
-dummyRemove :: State -> Key -> IO Bool
-dummyRemove state url = return False
+dummyStore :: FilePath -> Key -> Annex Bool
+dummyStore file url = return False
+dummyRemove :: Key -> Annex Bool
+dummyRemove url = return False
-downloadUrl :: State -> Key -> FilePath -> IO Bool
-downloadUrl state url file = do
- putStrLn $ "download: " ++ (show url)
- result <- try $ rawSystem "curl" ["-#", "-o", file, (show url)]
+downloadUrl :: Key -> FilePath -> Annex Bool
+downloadUrl url file = do
+ liftIO $ putStrLn $ "download: " ++ (show url)
+ result <- liftIO $ try $ rawSystem "curl" ["-#", "-o", file, (show url)]
case (result) of
Left _ -> return False
Right _ -> return True