Skip to content
Topaz6.0 · Before release
Download

Search documentation

Specification 6.0 · Not released · Tested product 5.21.3

Use arrow keys to choose a result. Press Enter to open.

Type an API name, diagnostic number, rule, or project topic.

    Diagnostics

    TPZ5530: Protocol cannot be derived for this type

    A derives clause asks for generated protocol behavior that this type's fields or payloads cannot support.

    Diagnostic and cause

    Link

    Protocol cannot be derived for this type

    Family
    topaz
    Phase
    check
    Code
    TPZ5530

    Cause and conditions

    Deriving Eq requires every contained field type to support equality. A function-valued field prevents Eq derivation and produces TPZ5530.

    Response

    Use a supported derives protocol and compatible stored types. Remove the clause or write an admitted manual implementation where that protocol permits one.

    Source evidence

    Compiler phase: check.

    Compiler explanation: A derives clause asks for generated protocol behavior that this type's fields or payloads cannot support.

    Message templates. The marker ⟨value⟩ stands for text computed for the reported program.

    • unknown protocol ⟨value⟩ in derives for ⟨value⟩; derivable protocols are Eq, Order, Show, JSON Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ5530]: cannot derive Eq for Callback: field action has a non-comparable type

    Deriving Eq requires every contained field type to support equality. A function-valued field prevents Eq derivation and produces TPZ5530.

    Rulediagnostics.tpz5530.p5.rule

    Protocol cannot be derived for this type

    Deriving Eq requires every contained field type to support equality. A function-valued field prevents Eq derivation and produces TPZ5530.

    Source evidence

    Response

    Link

    Use a supported derives protocol and compatible stored types. Remove the clause or write an admitted manual implementation where that protocol permits one.

    Reproduction and verification

    Link

    Rejected program

    Link
    example.tpzRejected programOpen in Playground
    1. record Callback derives Eq { action: () -> int }
    Expected outputNonzero exit
    No stdout.
    $ topaz check example.tpz · target product 5.21.3
    Expected result

    Expected result

    Rejection during check. Nonzero exit.

    • TPZ5530 diagnostic-tpz5530 at example.tpz:1:25
    Source evidence

    Repaired program

    Link
    example.tpzRepaired program
    1. record Callback derives Eq { action: int }
    Expected outputexit 0
    $ topaz check example.tpz · target product 5.21.3
    Expected result

    Expected result

    Checking accepts the program. Exit code 0.

    Source evidence

    Menu

    Download