title: Haskell data type alias naming
body: <p>I wrote a mathematical <code>Vector</code> module in Haskell.</p>
  
  <p>So I started out with:</p>
  
  <pre><code>data Vector a = Vector !a !a !a deriving (Eq, Show)
  </code></pre>
  
  <p>Fine—this lets me use any numerical data type I want. The problem is that I don't want to be writing <code>Double</code> and <code>Vector Double</code> everywhere for the simple reason that I shouldn't have to. So I add:</p>
  
  <pre><code>type Scalar = Double
  type Vector = Vector Scalar
  </code></pre>
  
  <p>But of course that second line is wrong, since there are now two declarations of <code>Vector</code>. So what should I change it to? I think to myself, no, I'm going to be writing this all over my code, so I want to leave the type alias simply as <code>Vector</code>. Which means I have to change the data type name. But if I change that, then I feel like I should also change the constructor, which makes everything more confusing. But if it feels awkward making the constructor have the same name as the type alias this way.</p>
  
  <p>Right now I have this:</p>
  
  <pre><code>type Scalar = Double
  type Vector = VectorT Scalar
  
  data VectorT a = Vector !a !a !a deriving (Eq, Show)
  </code></pre>
  
  <p>I picked <code>T</code> arbitrarily (I guess it stands for "type") but I'm not so sure about this. Normally when I document functions I would say <code>-- Calculate the magnitude of a Vector</code>, but with <code>VectorT</code> I feel like I should really be using <em>that</em> type name. So I resort to just referring to them as <code>vectors</code> (not capitalized)—except then I feel like I have to apply this convention to every comment for every data type.</p>
  
  <p>Has anyone been in a similar situation? Can anyone think of a more elegant solution in this case?</p>