<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">bmaxa@Branimirs-Air haskell % ghc -O2 dtchk.hs</div><div class="">Loaded package environment from /Users/bmaxa/.ghc/aarch64-darwin-8.10.7/environments/default</div><div class="">[1 of 1] Compiling Main ( dtchk.hs, dtchk.o )</div><div class="">Linking dtchk ...</div><div class="">bmaxa@Branimirs-Air haskell % ./dtchk</div><div class="">dtchk: Prelude.undefined</div><div class="">CallStack (from HasCallStack):</div><div class=""> error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err</div><div class=""> undefined, called at dtchk.hs:10:5 in main:Main</div><div class="">bmaxa@Branimirs-Air haskell % cat dtchk.hs</div><div class="">{-# LANGUAGE FlexibleInstances, KindSignatures,</div><div class=""> LiberalTypeSynonyms, StandaloneDeriving,</div><div class=""> FlexibleContexts #-}</div><div class="">data Foo sx x = Foo sx x</div><div class=""> deriving (Eq,Show)</div><div class=""><br class=""></div><div class="">data Bar (m :: * -> *) = Bar (m Int)</div><div class="">deriving instance Show a => Show (Bar (Foo a))</div><div class="">x :: Bar (Foo (Maybe Int))</div><div class="">x = undefined</div><div class="">deriving instance Eq a => Eq (Bar (Foo a))</div><div class="">main = print x</div><div class=""><br class=""></div><div class="">Greets, Branimir.</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On 08.10.2021., at 04:15, Ttt Mmm via Haskell-Cafe <<a href="mailto:haskell-cafe@haskell.org" class="">haskell-cafe@haskell.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><div class="default-style" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">{-# LANGUAGE FlexibleInstances, KindSignatures, LiberalTypeSynonyms, StandaloneDeriving #-}</div><div class="default-style" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">-- This works:<span class="Apple-converted-space"> </span><br class="">data Foo s x = Foo (s x) x<span class="Apple-converted-space"> </span><br class="">deriving (Eq)</div><div class="default-style" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">-- This replacement doesn't:<span class="Apple-converted-space"> </span><br class="">{-<span class="Apple-converted-space"> </span><br class="">data Foo' sx x = Foo' sx x<span class="Apple-converted-space"> </span><br class="">deriving (Eq)<span class="Apple-converted-space"> </span><br class="">type Foo (s :: * -> *) (x :: *) = Foo' (s x) x<span class="Apple-converted-space"> </span><br class="">-}</div><div class="default-style" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">data Bar (m :: * -> *) = Bar (m Int)</div><div class="default-style" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br class=""></div><div class="default-style" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">-- Neither of these typecheck:<span class="Apple-converted-space"> </span><br class="">x :: Bar (Foo Maybe)<span class="Apple-converted-space"> </span><br class="">x = undefined<span class="Apple-converted-space"> </span><br class=""></div><div class="default-style" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">deriving instance Eq (Bar (Foo Maybe))<span class="Apple-converted-space"> </span></div></div></blockquote></div><br class=""></body></html>