Skip to content

Stack new and init look for an existing stack.yaml #1604

@mgsloan

Description

@mgsloan

If the stack.yaml is invalid, then things fail:

mgsloan@computer:~/fpco/test-stack$ mkdir parent
mgsloan@computer:~/fpco/test-stack$ cd parent
mgsloan@computer:~/fpco/test-stack/parent$ stack new child
Downloading template "new-template" to create project "child" in child/ ...
The following parameters were needed by the template but not provided: category
You can provide them in /home/mgsloan/.stack/config.yaml, like this:
templates:
  params:
    category: value
Or you can pass each one as parameters like this:
stack new child new-template -p "category:value"
Writing default config file to: /home/mgsloan/fpco/test-stack/parent/child/stack.yaml
Basing on cabal files:
- /home/mgsloan/fpco/test-stack/parent/child/child.cabal

Checking against build plan lts-3.19
Selected resolver: lts-3.19
Wrote project config to: /home/mgsloan/fpco/test-stack/parent/child/stack.yaml
mgsloan@computer:~/fpco/test-stack/parent$ rm child/stack.yaml 
mgsloan@computer:~/fpco/test-stack/parent$ echo "invalid" > stack.yaml
mgsloan@computer:~/fpco/test-stack/parent$ cd child
mgsloan@computer:~/fpco/test-stack/parent/child$ stack init
Could not parse '/home/mgsloan/fpco/test-stack/parent/stack.yaml':
AesonException "when expecting a ProjectAndConfigMonoid, encountered String instead"
See http://docs.haskellstack.org/en/stable/yaml_configuration.html.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions