Skip to content

Deriving strategies #68

Open
Open

Description

@adamgundry

At the moment, api-tools uses derived instances for its generated types, but does not specify the deriving strategy. This can lead to problems, in particular for newtypes when both DeriveAnyClass and GeneralizedNewtypeDeriving are enabled, because the choice of strategy is ambiguous. Ideally we would explicitly request newtypeStrategy to avoid this; although that might require the DerivingStrategies extension to be enabled in user code.

Activity

  1. cdornan commented on Aug 19, 2020

    @cdornan
    Contributor

    I agree — best to be explicit, even at the cost of requiring DerivingStrategies.

  2. adamgundry commented on Aug 19, 2020

    @adamgundry
    ContributorAuthor

    FWIW it looks like TH code can test which extensions are enabled, so it would be possible to do this in a backwards-compatible way: require DerivingStrategies only if DeriveAnyClass is enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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