Permalink
Browse files

prototype depending on the package list

  • Loading branch information...
1 parent 0c8bf3e commit 583c0bbff36aa94e740bf71b6dd8d82211345418 @phischu committed Mar 18, 2013
Showing with 9 additions and 1 deletion.
  1. +9 −1 Master.hs
View
@@ -15,6 +15,7 @@ type Version = String
newtype ExtractedPackage = ExtractedPackage Package deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
newtype PackageArchive = PackageArchive Package deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
+newtype PackageList = PackageList [Package] deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
instance Rule ExtractedPackage () where
storedValue (ExtractedPackage (Package (name,version))) = do
@@ -26,6 +27,9 @@ instance Rule PackageArchive () where
exists <- IO.doesFileExist (archiveDirectory package)
if exists then return (Just ()) else return Nothing
+instance Rule () PackageList where
+ storedValue () = return Nothing
+
extractedDirectory :: FilePath
extractedDirectory = "Packages/"
@@ -38,7 +42,11 @@ packageUrl (Package (name,version)) = concat ["hackage.haskell.org/packages/arch
main :: IO ()
main = shake shakeOptions {shakeThreads = 4} $ do
- action (apply1 (ExtractedPackage (Package ("aeson-lens","0.1.0.2"))) :: Action ())
+ action (do
+ PackageList packages <- apply1 ()
+ apply (map ExtractedPackage packages) :: Action [()])
+
+ rule (\() -> Just (return (PackageList [Package ("aeson-lens","0.1.0.2")])))
rule (\(ExtractedPackage package) -> Just $ do
liftIO (IO.createDirectoryIfMissing True extractedDirectory)

0 comments on commit 583c0bb

Please sign in to comment.