Avoiding "No explicit method ..." warnings
Thu, 23 Jan 2003 14:54:40 -0000
| -----Original Message-----
| From: George Russell [mailto:email@example.com]
| Sent: 21 January 2003 15:43
| To: Simon Peyton-Jones
| Cc: Dean Herington; firstname.lastname@example.org
| Subject: Re: Avoiding "No explicit method ..." warnings
| Simon Peyton-Jones wrote:
| > One other idea though. Suppose you say
| > class ComplicatedClass x where
| > _simpleTitleFn :: x -> String
| > muchMoreComplicatedTitleFn :: extra arguments -> x -> IO ...
| > In general GHC doesn't report "warning unused" for variables whose
| > begin with an underscore. In the case of class methods, I don't
| > it suppresses the warning, but that would be an easy change to make.
| > Indeed, it would arguably be more consistent to do so anyway
| > > #-}) which compiles exactly as normal except that (1) no warning
| > > given for instances which don't define it; (2) a warning is given
| > > whenever anyone outside the class declaration *uses*
| > The "_" idea would achieve (1). You could get (2) by not exporting
| > "_" method from the module defining ComplicatedClasss.
| > How would that be?
| Yes, this looks just as good as my original idea, if not better.
| as it "would be an easy change to make".
| In fact there are some cases where I might want to use "simpleTitleFn"
| "Trust me, it's defined for this type" basis, but that could be
| exporting an equivalent, but deprecated, function.