
12 Nov
2021
12 Nov
'21
1:27 p.m.
GHC accepts: {-# LANGUAGE DerivingStrategies, DerivingVia #-} newtype Foo = Foo Int deriving (Show, Eq) via (Bar) newtype Bar = Bar Int deriving (Show, Eq) via (Foo) should there be any effort to avoid circular definitions? Of course one could always implement an explicit `show` method that diverges, so perhaps this is no worse, but on the other hand, statically deciding divergence looks potentially easier in this case... On the other hand actual definitions like this seem unlikely in practice, so perhaps not worth burning precious compiler cycles to detect them? -- Viktor.