FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Multiparameter instance incorrectly considered partially overlapping · Issue #4338 · purescript/purescript · GitHub

Multiparameter instance incorrectly considered partially overlapping #4338

Description

Description

See repro section for precise description of the symptoms. I'm not completely sure what the problem is, but it looks like the apartness check happens separately for each parameter of the instance, so that the instance may be considered partially overlapping if each parameter cannot be shown to be "apart" when considered in isolation, even if there is no possible substitution that would match all parameters together.

To Reproduce

newtype N a = N a

class C a b
instance C (N a) (N a)
else instance C a (N a)

x :: forall a. C a (N a) => Unit
x = unit

y :: Unit
y = x

The last line yields an error:

No type class instance was found for C t0 (N t0)
The following instance partially overlaps ...
    instance C (N a) (N a)

How can C (N a) (N a) possibly overlap C t0 (N t0)? That would require t0 ~ N t0.

Expected behavior

The second instance should be chosen, allowing the program to compile.

PureScript version

0.15.2

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


    Back | FazBrowse Home | New Git URL