Making cabalDependPackages pure.
This commit is contained in:
parent
14ea5a6d71
commit
431e3fa904
2
Cabal.hs
2
Cabal.hs
@ -47,7 +47,7 @@ fromCabal ghcOptions = do
|
||||
idirs = case hsSourceDirs of
|
||||
[] -> [cdir,owdir]
|
||||
dirs -> map (cdir </>) dirs ++ [owdir]
|
||||
depPkgs <- removeMe cfile <$> cabalDependPackages cabal
|
||||
let depPkgs = removeMe cfile $ cabalDependPackages cabal
|
||||
return (gopts,idirs,depPkgs)
|
||||
|
||||
removeMe :: FilePath -> [String] -> [String]
|
||||
|
@ -48,8 +48,8 @@ allDependsOfDescription pd =
|
||||
getDependencyPackageName :: Dependency -> String
|
||||
getDependencyPackageName (Dependency (PackageName n) _) = n
|
||||
|
||||
cabalDependPackages :: GenericPackageDescription -> IO [String]
|
||||
cabalDependPackages :: GenericPackageDescription -> [String]
|
||||
cabalDependPackages =
|
||||
return . toList . fromList
|
||||
toList . fromList
|
||||
. map getDependencyPackageName
|
||||
. allDependsOfDescription
|
||||
|
@ -1,5 +1,6 @@
|
||||
module CabalApiSpec where
|
||||
|
||||
import Control.Applicative
|
||||
import Test.Hspec
|
||||
import CabalApi
|
||||
|
||||
@ -7,7 +8,7 @@ spec :: Spec
|
||||
spec = do
|
||||
describe "cabalDependPackages" $ do
|
||||
it "extracts dependent packages" $ do
|
||||
pkgs <- cabalParseFile "test/data/cabalapi.cabal" >>= cabalDependPackages
|
||||
pkgs <- cabalDependPackages <$> cabalParseFile "test/data/cabalapi.cabal"
|
||||
pkgs `shouldBe` ["Cabal","base","containers","convertible","directory","filepath","ghc","ghc-paths","ghc-syb-utils","hlint","hspec","io-choice","old-time","process","regex-posix","syb","time","transformers"]
|
||||
|
||||
describe "cabalBuildInfo" $ do
|
||||
|
Loading…
Reference in New Issue
Block a user