Skip to content

stack new -- AesonException #2275

Closed
Closed
@gitfoxi

Description

@gitfoxi

stack new hello-world fails with

Could not parse '/home/m/.stack/config.yaml':
AesonException "failed to parse field 'params': when expecting a Text, encountered Number instead"
See http://docs.haskellstack.org/en/stable/yaml_configuration.html.

When my config.yaml looks like

templates:
  params:
    author-email: [email protected]
    author-name: michael fox
    category: Application
    copyright: copytright michael fox 2016
    github-username: gitfoxi
    year: 2016

Works fine if I change the year line to:

    year: "2016"

I think it's pretty clear what's going on here, but the documentation at http://docs.haskellstack.org/en/stable/yaml_configuration/ doesn't mention the year parameter. I learn about from when I run stack new with a blank config.yaml. It says:

Downloading template "new-template" to create project "hello-world" in hello-world/ ...
The following parameters were needed by the template but not provided: author-email, author-name, category, copyright, github-username, year
You can provide them in /home/m/.stack/config.yaml, like this:
templates:
  params:
    author-email: value
    author-name: value
    category: value
    copyright: value
    github-username: value
    year: value

I think it could be fixed by requiring that year be a string instead of a value or by coercing whatever value happens to be to a string using Aeson's encode function.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions