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
(should say "No instance for (Ord B)")
the problem is caused by
Eq (A' ext)
having a superclassEq (B' ext)
and vice versa, instead of usingAAll
/BAll