
Hi, I have a module that contains (among other stuff) the following code: module Music.Diatonic.Note ( Note( C,D,E,F,G,A,B ), Nte, noteMap, ($#), ) where -- | Use these constructors to create 'Note's. To alter them, use the 'flat' or 'sharp' functions. data Note = C | D | E | F | G | A | B | Note Accidental Note deriving (Eq) -- | Many musical objects have a note at their core (scales, chords, ...). The 'Nte' class allows these objects -- to make use of all the note-manipulating functions. class Nte a where -- | Applies a 'Note' manipulating function to an instance of the 'Nte' class. noteMap :: (Note -> Note) -> a -> a -- | Operator for 'noteMap'. ($#) :: (Note -> Note) -> a -> a ($#) = noteMap When I run haddock on it it gives the following warnings that I don't really understand: Warning: Music.Diatonic.Note: noteMap is exported separately but will be documented under Nte. Consider exporting it together with its parent(s) for code clarity. Warning: Music.Diatonic.Note: $# is exported separately but will be documented under Nte. Consider exporting it together with its parent(s) for code clarity. Warning: Music.Diatonic.Note: notes is exported separately but will be documented under Nts. Consider exporting it together with its parent(s) for code clarity. What exactly does this mean? I am exporting Type class stuff inapproriately? Patrick -- ===================== Patrick LeBoutillier Rosemère, Québec, Canada

The common way to export type classes is Nte(..) I'm not sure what happens if you export the "closed" class and the methods separately - I'd guess it means you can use the methods and put the class name in type signatures but can't declare new instances. As I've never needed to close classes, it's not something I've looked into.

On Tuesday 05 April 2011 23:06:37, Stephen Tetley wrote:
The common way to export type classes is
Nte(..)
I'm not sure what happens if you export the "closed" class and the methods separately - I'd guess it means you can use the methods and put the class name in type signatures but can't declare new instances.
You can. It's just uncommon to export the methods separate from the class, and maybe a little bug-prone for refactoring. It's a style warning, haddock gives, nothing more.
As I've never needed to close classes, it's not something I've looked into.

Stephen,
Great. That solved the warnings.
Patrick
On Tue, Apr 5, 2011 at 5:06 PM, Stephen Tetley
The common way to export type classes is
Nte(..)
I'm not sure what happens if you export the "closed" class and the methods separately - I'd guess it means you can use the methods and put the class name in type signatures but can't declare new instances. As I've never needed to close classes, it's not something I've looked into.
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- ===================== Patrick LeBoutillier Rosemère, Québec, Canada
participants (3)
-
Daniel Fischer
-
Patrick LeBoutillier
-
Stephen Tetley