Skip to content

Tolerate funny includes #262

@lf-

Description

@lf-

We use hpack, which results in having a lot of yaml.

Excerpt of such YAML:

<<: !include ../../hpack-common/defaults.yaml

name: some-package
version: 0.1.0.0
license: NONE
author: ""
maintainer: ""

flags:
  dev:
    description: "some flag"
    manual: true
    default: false
  <<: *defaultflags

This yaml is valid in hpack, where it pulls the anchor value from hpack-common/defaults.yaml, which contains:

<<: !include default-extensions.yaml
<<: !include flags.yaml
<<: !include ghc-options.yaml

And then hpack-common/flags.yaml contains:

_defaultflags: &defaultflags
  hie:
    description: Generate HIE files
    manual: true
    default: true

This whole thing is valid in the Haskell yaml parser as used by hpack and does merge all of the << together even though my language server does not like it and apparently nor does yamlfmt:

$ yamlfmt local-packages/somepackage/package.yaml
encountered the following formatting errors:
local-packages/somepackage/package.yaml: yaml: unknown anchor 'defaultflags' referenced

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions