Skip to content

Warn and Fail constraints in instance context of superclasses are ignored when deriving newtype instances #3964

@kl0tl

Description

@kl0tl

Description

What the issue title says.

To Reproduce

The following example doesn’t yield any warning:

module Example where

import Prim.TypeError (class Warn, Text)

class Deprecated
instance deprecated :: Warn (Text "deprecated") => Deprecated

class Deprecated <= C (a :: Type)

newtype N a = N a

derive newtype instance c :: C a => C (N a)

but a regular instance declaration does:

instance c :: C a => C (N a)
Warning found:
in module Example
at Example.purs:12:1 - 12:29 (line 12, column 1 - line 12, column 29)

  A custom warning occurred while solving type class constraints:

    deprecated


in value declaration c

See https://github.com/purescript/documentation/blob/master/errors/UserDefinedWarning.md for more information,
or to contribute content related to this warning.

Expected behavior

Deriving newtype instances should yield the same warnings and failures than regular instances declarations.

PureScript version

0.14.0-rc3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions