stack-yaml-0.1.0.0: Parse a stack.yaml file

Safe HaskellNone
LanguageHaskell2010

Data.Stack.Yaml

Description

Parse a stack.yaml file

Synopsis

Documentation

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.