Skip to content

Use less permissive types in the config monoids #2267

@sjakobi

Description

@sjakobi

ConfigMonoid (and probably other config monoids too) contains a few fields that have more permissive types than necessary. This has the effect that bad inputs go undetected or result in errors that are reported out of context or only after the inputs have been passed to ghc.

A few of the problematic fields:

  • configMonoidWorkDir
  • configMonoidOs
  • configMonoidExtraIncludeDirs

Example interaction:

$ stack --extra-lib-dirs --oops build
these-0.7: unregistering (local file changes: Control/Monad/Chronicle.hs Control/Monad/Chronicle/Class.hs Control/Monad/Trans/Chronicle.hs Data...)
these-0.7: configure
Configuring these-0.7...
Warning: 'extra-lib-dirs: --oops' directory does not exist.
...

Compare this to the error message for an argument that must be a Path Abs Dir:

$ stack --stack-root --oops path
option --stack-root: Failed to parse absolute path to directory: '--oops'

Usage: stack [--help] [--version] [--numeric-version] [--hpack-numeric-version]
...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions