False positive report: top-level bindings with no signature

Mod note: As of SDK 1.5.0 Scenarios have been superseded by the more powerful Daml Script. We now recommend using that for all purposes. For more information, and to learn how to use Script please check out @Andreas’ post on our blog.

Given the following are set in daml.yaml:

build-options:
  - '--ghc-option'
  - '-Werror'
  - '--ghc-option'
  - '-Wunused-binds'

This should raise errors if a top-level binding has no signature. This is what is expected and desired.

However, why is the following considered to have no signature and hence reported?

setupRoles: Scenario TestRoles = scenario do
1 Like

The code you wrote uses a pattern type signature

setupRoles :: Scenario TestRoles = …

The warning triggers on missing top-level type signatures, so to fix it you need to change it to move the type signature out of the body.

setupRoles : Scenario TestRoles
setupRoles = …

If you do not like this warning, you can use --ghc-option=-Wno-missing-signatures to disable it. There is currently no way to enable the warning but have it be satisfied by pattern signatures.

2 Likes