1{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE StandaloneDeriving #-}
3{-# OPTIONS_GHC -fno-warn-orphans #-}
7import Control.DeepSeq.Generics
9import Control.Monad.Par.Combinator
10import Control.Monad.Par.IO
11import Control.Monad.Trans
14import Data.Yaml ( decodeFile )
15import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
16import Distribution.Package
17import Distribution.PackageDescription
18import Distribution.Version
19import GHC.Generics ( Generic )
20import Stackage.Types hiding ( display )
21import System.Directory
23import Text.Show.Pretty
24import Distribution.Compiler
27yo = readView "/home/simons/src/cabal2nix/hackage2nix/stackage-nightly/nightly-2015-09-11.yaml" >>= putStrLn . ppShow
31 , flagOverrides :: (Map FlagName Bool)
34 , runLinuxBuilds :: Bool
36 deriving (Show, Eq, Ord, Generic)
39 { compiler :: CompilerId
40 , corePackages :: Map PackageName Version
41 , packages :: Map PackageName Spec
43 deriving (Show, Generic)
45instance NFData Spec where
46instance NFData View where
49views = runParIO $ readStackage "lts-haskell"
51readStackage :: FilePath -> ParIO [View]
52readStackage dirPath = do
53 filePaths <- liftIO (listFiles dirPath)
54 parMapM (liftIO . readView) [ dirPath </> p | p <- filePaths, takeExtension p == ".yaml" ]
56readView :: FilePath -> IO View
57readView = fmap fromBuildPlan . readBuildPlan
59fromBuildPlan :: BuildPlan -> View
60fromBuildPlan bp = View (CompilerId GHC (siGhcVersion (bpSystemInfo bp)))
61 (siCorePackages (bpSystemInfo bp))
62 (Map.map fromPackagePlan (bpPackages bp))
64fromPackagePlan :: PackagePlan -> Spec
65fromPackagePlan pp = Spec (ppVersion pp)
67 (pcTests ppc == ExpectSuccess)
68 (pcHaddocks ppc == ExpectSuccess)
70 where ppc = ppConstraints pp
72readBuildPlan :: FilePath -> IO BuildPlan
73readBuildPlan = fmap fromJust . decodeFile
75listFiles :: FilePath -> IO [FilePath]
77 let isFile p = doesFileExist (path </> p)
78 getDirectoryContents path >>= filterM isFile . Prelude.filter (\x -> head x /= '.')
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list