Safe Haskell | None |
---|
Dealing with Cabal packages in Fay's own special way.
- resolvePackages :: CompileConfig -> IO CompileConfig
- resolvePackage :: CompileConfig -> String -> IO CompileConfig
- describePackage :: Maybe FilePath -> String -> IO String
- shareDirs :: String -> Maybe [FilePath]
- checkDirExists :: FilePath -> IO ()
Documentation
resolvePackages :: CompileConfig -> IO CompileConfigSource
Given a configuration, resolve any packages specified to their data file directories for importing the *.hs sources.
resolvePackage :: CompileConfig -> String -> IO CompileConfigSource
Resolve package.
describePackage :: Maybe FilePath -> String -> IO StringSource
Describe package with ghc-pkg.
Weinsworth : Why are you not using the GHC API which would provide you this information like in modules like Packages which has functions like
collectIncludeDirs :: [PackageConfig] -> [FilePath]
and awesome stuff like that. What are you, stupid?
Batemen : Pretty much. I think this might be a little faster than initializing GHC, and using the GHC API adds a lot of link time when you use it.
Weinsworth : Uh huh.
Batemen: Yeah. Stop looking at me like that.
shareDirs :: String -> Maybe [FilePath]Source
Get the share dirs of the package.
Alright. Stop. Collaborate and listen.
You're gonna have to stop scrolling and read this.
I can't figure out how to get the data-dirs from the package description.
- It doesn't seem to be in the Cabal API's PackageDescription type. * It doesn't seem to be in the ghc-pkg description. * I can't find out how to read the Cabal configuration. Yeah, I could probably find it eventually. Shut up.
So what I'm doing is parsing the “import-dirs” flag, which appears in ghc-pkg's output like this:
homechrisProjectsmefay-jquerycabal-devlibfay-jquery-0.1.0.0ghc-7.4.1
And I'm going to replace “lib” with “share” and drop the “ghc-*” and that, under a *normal* configuration, gives the share directory.
Under an atypical situation, we're going to throw an error and you guys will just have to submit a pull request or some code to do this better, because I've got better things to be doing, like climbing trees, baking cookies and reading books about zombies.
checkDirExists :: FilePath -> IO ()Source
Might as well check the dir that we munged to death actually exists. -___ -