Trex-generated Show instances dodgy
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
participants (1)
-
Anthony Clayden