Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Stack.Yaml
Description
Parse a stack.yaml file
credit: stack2nix v. 0.1.2.0
https://hackage.haskell.org/package/stack2nix-0.1.2.0/docs/Stack2nix.html
author: Jacob Mitchell ([email protected])
- data Package
- data RemotePkgConf = RemotePkgConf {}
- data StackConfig = StackConfig {}
- parseStackYaml :: ByteString -> Maybe StackConfig
- getResolver :: IO Text
Documentation
Constructors
LocalPkg FilePath | |
RemotePkg RemotePkgConf |
data RemotePkgConf Source #
Instances
data StackConfig Source #
Instances
parseStackYaml :: ByteString -> Maybe StackConfig Source #
parse a stack.yaml file.
example:
import qualified Data.ByteString as BS maybeConfig <- parseStackYaml <$> BS.readFile "stack.yaml"
or:
>>>
import qualified Data.ByteString.Char8 as BSC
>>>
import Data.Maybe (fromJust)
>>>
'a'
'a'>>>
let yaml = BSC.pack $ unlines [ "resolver: lts-8.24" , "packages:" , "- ." , "extra-deps: []" , "flags: {}" , "extra-package-dbs: []" ]
>>>
let config = fromJust $ parseStackYaml yaml
>>>
config
StackConfig {resolver = "lts-8.24", packages = [LocalPkg "."], extraDeps = []}
getResolver :: IO Text Source #
Look for a stack.yaml file in the working directory, extract the 'resolver:' field, and return it as Text.