From anthony.d.clayden at gmail.com Fri Aug 26 02:04:36 2022 From: anthony.d.clayden at gmail.com (Anthony Clayden) Date: Fri, 26 Aug 2022 14:04:36 +1200 Subject: Trex-generated Show instances dodgy Message-ID: Strange: on loading this module, Hugs complains (this is standard-issue Sep 2006 Hugs in Hugsmode) > - An instance of ShowRecRow (x :: a, y :: a) is required to derive Show (NPoint a) Just loading it again and the complaint disappears. > module NPoint where > > import Hugs.Trex > > newtype Num a => NPoint a = MkNPoint ( Rec( x :: a, y :: a)) deriving (Eq, Show) > If I ask for :info ShowRecRow after the failed load, I see an instance each for label x, y -- as well as the EmptyRow instance (standard with Hugs.Trex). If I :load Hugs.Trex after the failed load, those two instances have gone; I can load NPoint ok. On firing up Hugs, if I :load Hugs.Trex before :load NPoint, the error still happens. But if I >print (z = 5) -- some arbitrary label then :load NPrint, all is fine. (And there's no ghost ShowRecRow instance for z.) If I 'clear modules' after the failed load; then :load NPoint, no error. Same for an ordinary data decl wrapping a Trex record, with deriving. Same if I include some arbitrary `silly = show (silly = "shilly")`. AntC -------------- next part -------------- An HTML attachment was scrubbed... URL: