Skip to content

reduction stack overflow for non-existent instances #27

Description

@andy-morris
extensible [d|
    data A = A B        deriving Eq
    data B = B A | Stop deriving Eq
  |]

data T
extendA "A" [] [t|T|] defaultExtA
extendB "B" [] [t|T|] defaultExtB
>>> Stop < Stop
<interactive>:1:1: error:
    • Reduction stack overflow; size = 201
      When simplifying the following type: Eq (B' ext0)
      Use -freduction-depth=0 to disable this check
      (any upper bound you could choose might fail unpredictably with
       minor updates to GHC, so disabling the check is recommended if
       you're sure that type checking should terminate)
    • In the expression: Stop < Stop
      In an equation for ‘it’: it = Stop < Stop

(should say "No instance for (Ord B)")

>>> :i A' B'
type role A' nominal
data A' ext = A' (B' ext) !(XA ext) | AX !(AX ext)
        -- Defined at A.hs:9:1
instance (Eq (AX ext), Eq (B' ext), Eq (XA ext)) => Eq (A' ext)
  --                   ↑↑↑↑↑↑↑↑↑↑↑
  -- Defined at A.hs:9:1
type role B' nominal
data B' ext
  = B' (A' ext) !(XB ext) | Stop' !(XStop ext) | BX !(BX ext)
        -- Defined at A.hs:9:1
instance (Eq (A' ext), Eq (BX ext), Eq (XB ext), Eq (XStop ext)) => Eq (B' ext)
  --      ↑↑↑↑↑↑↑↑↑↑↑
  -- Defined at A.hs:9:1

the problem is caused by Eq (A' ext) having a superclass Eq (B' ext) and vice versa, instead of using AAll/BAll

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions