<div dir="ltr">The following probably captures community practice:<div><br></div><div>a) If the type is truly arbitrary, such that there is no meaningful info to add beyond the positions it occurs in the type, then give it an arbitrary name, like 'a', 'b', or 'c'.</div><div>b) If there is a convention associated with a type or class that occurs in the type signature, to which the type variable is a parameter, then use that (usually one-letter) name.<br></div><div>c) Otherwise, use a longer name.</div><div><br></div><div>You seem to be making the case that (b) is confusing.  You may be right, and I have no particular desire to defend the current practice.  But if you're wondering where one would be expected to find the meaning, that's it: find the primary type (or class) to which it's a parameter, and there is usually a convention set forth there.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 10, 2017 at 3:29 PM, Jeffrey Brown <span dir="ltr"><<a href="mailto:jeffbrown.the@gmail.com" target="_blank">jeffbrown.the@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Haskellers tend to use uninformative single-letter type variables. A case in point:</div><div><br></div><div>    Megaparsec> :i ParsecT                                                         </div><div>    type role ParsecT nominal nominal representational representational</div><div>    newtype ParsecT e s (m :: * -> *) a ...</div><div><br></div><div>I've gotten used to the conventions that "a" stands for anything and "m" stands for monad -- but without digging into the code it wasn't initially obvious to me whether "s" stood for stream or state.</div><div><br></div><div>Single-letter type variables don't seem to always be the standard, though:</div><div>    </div><div>    Megaparsec> :i between</div><div>    between :: Applicative m => m open -> m close -> m a -> m a</div><div>            -- Defined in ‘Control.Applicative.<wbr>Combinators’</div><div><br></div><div>My questions are: (1) Are the brevity gains worth the confusion costs? (2) If I'm looking at a new library for the first time and trying to figure out what a type variable stands for, is there a canonical way to do it? Flailing through documentation at random? Unifying types by hand?</div><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_-552809586475850608gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Jeff Brown | Jeffrey Benjamin Brown</div><div dir="ltr"><a href="https://msu.edu/~brown202/" style="font-size:12.8px" target="_blank">Website</a>   |   <a href="https://www.facebook.com/mejeff.younotjeff" style="font-size:12.8px" target="_blank">Facebook</a>   |   <a href="https://www.linkedin.com/in/jeffreybenjaminbrown" style="font-size:12.8px" target="_blank">LinkedIn</a><span style="font-size:12.8px">(spammy, so I often miss messages here)   </span><span style="font-size:12.8px">|</span><span style="font-size:12.8px">   </span><a href="https://github.com/jeffreybenjaminbrown" style="font-size:12.8px" target="_blank">Github</a><span style="font-size:12.8px">   </span></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</font></span></div>
<br>______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a><br>
Only members subscribed via the mailman list are allowed to post.<br></blockquote></div><br></div>