[Haskell-cafe] Module.T naming style (was: matrix computations
based on the GSL)
Andrew Pimlott
andrew at pimlott.net
Thu Jul 14 19:02:41 EDT 2005
On Wed, Jul 13, 2005 at 06:13:48PM +0200, Alberto Ruiz wrote:
> I have changed the function names as suggested. This new style is clearly
> better, allowing Vector.add, Matrix.add, Vector.Complex.add,
> Matrix.Complex.add, etc.
...
> Now we can have Vector.T a and Matrix.T a for any storable a (although
> at this point most functions are only defined for Double). For
> example:
I would like to bristle mildly against the style of using Vector.T to
represent the vector type. The reasons are 1) it is cryptic to those
not used to the convention; 2) enshrining one-type-per-module in the
naming convention is not IMO justified, and may prove limiting; 3) it
doesn't work out well when you import a module that reexports Vector.
I would say leave it Vector.Vector. Then the user may import the module
unqualified, or qualified with an abbreviation like V, define his own
synonym ("type Vector = Vector.Vector"), or just put up with the light
annoyance of writing "Vector.Vector".
> 1) If I define
>
> foo :: Vector.T a -> Matrix.T a
>
> Haddock (version 0.6) shows just this:
>
> foo :: T a -> T a
I think this is evidence that trying to treat the "primary type" as a
special case in naming creates more annoyances than it eliminates.
Andrew
More information about the Haskell-Cafe
mailing list