Skip to content

Strange behavior: functional dependencies + row typeclass parameters #4585

@klntsky

Description

@klntsky

To Reproduce

This builds:

module Repro where

import Prim.RowList as RL

class What
      (a :: RL.RowList Type)
      (b :: Row Type)
      (c :: RL.RowList Type)
       | b -> a, c -> b -- , a -> c

instance What RL.Nil () RL.Nil

But if I uncomment the last fundep, I see this:

at src/Repro.purs:11:1 - 11:31 (line 11, column 1 - line 11, column 31)

  Type class instance head is invalid due to use of type

    ()

  All types appearing in instance declarations must be of the form T a_1 .. a_n, where each type a_i is of the same form, unless the type is fully determined by other type class arguments via functional dependencies.

in type class instance

  Repro.What Nil
             ()
             Nil

Expected behavior

The last fundep should not lead to a build error.

PureScript version

0.15.15

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