Trex-generated Show instances dodgy
Anthony Clayden <[email protected]> Fri, 26 Aug 2022 14:04:36 +1200
| Newsgroups | gmane.comp.lang.haskell.hugs.bugs |
|---|---|
| Message-ID | <CABU_mxgxUaW28-SVgj2KjK+J0WDeT6vPLZ5hURiDAXh2mKM_ww@mail.gmail.com> |
--===============2941707021485464493== Content-Type: multipart/alternative; boundary="00000000000089283a05e71b5681" --00000000000089283a05e71b5681 Content-Type: text/plain; charset="UTF-8" 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 --00000000000089283a05e71b5681 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Strange: on loading this module, Hugs complains (this is s= tandard-issue Sep 2006 Hugs in Hugsmode)<div><br></div><div>>=C2=A0- An = instance of ShowRecRow (x :: a, y :: a) is required to derive Show (NPoint = a)</div><div><br></div><div>Just loading it again and the complaint disappe= ars.</div><div><br></div><div>> module NPoint =C2=A0where</div>><br>&= gt;=C2=A0 =C2=A0 =C2=A0import Hugs.Trex<br>><br>>=C2=A0 =C2=A0 =C2=A0= newtype Num a =3D> NPoint a =C2=A0=3D MkNPoint ( Rec( x :: a, y :: a)) = =C2=A0deriving (Eq, Show)<br>><div><br></div><div>If I ask for :info Sho= wRecRow 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.Tr= ex=C2=A0after the failed load, those two instances have gone; I can load NP= oint ok.</div><div><br></div><div>On firing up Hugs, if I :load Hugs.Trex= =C2=A0before :load NPoint, the error still happens. But if I=C2=A0</div><di= v><br></div><div>>print (z =3D 5)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -= - some arbitrary label</div><div><br></div><div>then :load NPrint, all is f= ine. (And there's no ghost ShowRecRow instance for z.)</div><div><br></= div><div>If I 'clear modules' after the failed load; then :load NPo= int, no error.<br></div><div><br></div><div>Same for an ordinary data decl = wrapping a Trex record, with deriving. Same if I include some arbitrary `si= lly =3D show (silly =3D "shilly")`.</div><div><br></div><div><div= >AntC</div><br class=3D"gmail-Apple-interchange-newline"></div></div> --00000000000089283a05e71b5681-- --===============2941707021485464493== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSHVncy1CdWdz IG1haWxpbmcgbGlzdApIdWdzLUJ1Z3NAaGFza2VsbC5vcmcKaHR0cDovL21haWwuaGFza2VsbC5v cmcvY2dpLWJpbi9tYWlsbWFuL2xpc3RpbmZvL2h1Z3MtYnVncw== --===============2941707021485464493==--