RE: Avoiding "No explicit method ..." warnings

Done! | -----Original Message----- | From: George Russell [mailto:ger@tzi.de] | Sent: 21 January 2003 15:43 | To: Simon Peyton-Jones | Cc: Dean Herington; glasgow-haskell-users@haskell.org | Subject: Re: Avoiding "No explicit method ..." warnings | | Simon Peyton-Jones wrote: | [snip] | > 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 name | > begin with an underscore. In the case of class methods, I don't think | > 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 is | > > given for instances which don't define it; (2) a warning is given | > > whenever anyone outside the class declaration *uses* simpleTitleFn. | > | > The "_" idea would achieve (1). You could get (2) by not exporting the | > "_" method from the module defining ComplicatedClasss. | > | > How would that be? | [snip] | Yes, this looks just as good as my original idea, if not better. Especially | as it "would be an easy change to make". | | In fact there are some cases where I might want to use "simpleTitleFn" on a | "Trust me, it's defined for this type" basis, but that could be achieved by | exporting an equivalent, but deprecated, function.
participants (1)
-
Simon Peyton-Jones