1module ClassInstType where
2
3class Dir d where
4        localDir :: d -> IO FilePath
5
6instance Dir Directory where
7        localDir (Local f) = return f
8        localDir
9          (Darcs{url = url, darcsVersion = Patch patch,
10                 subDirectory = subDir})
11          = do tmp <- createTempDir 0 "haskelld"
12               darcsOut <- runDarcsCommand tmp "get"
13                             ["--lazy", "--to-match", "hash " ++ patch, url, "fs"]
14               print darcsOut
15               let (ExitSuccess, "", out) = darcsOut
16               print out
17               return $ tmp </> "fs" </> subDir
18
19type URL = String
20