[Haskell-cafe] Investigating single-letter type variables

Jeffrey Brown jeffbrown.the at gmail.com
Thu Aug 10 22:29:00 UTC 2017


Haskellers tend to use uninformative single-letter type variables. A case
in point:

    Megaparsec> :i ParsecT

    type role ParsecT nominal nominal representational representational
    newtype ParsecT e s (m :: * -> *) a ...

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.

Single-letter type variables don't seem to always be the standard, though:

    Megaparsec> :i between
    between :: Applicative m => m open -> m close -> m a -> m a
            -- Defined in ‘Control.Applicative.Combinators’

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?

-- 
Jeff Brown | Jeffrey Benjamin Brown
Website <https://msu.edu/~brown202/>   |   Facebook
<https://www.facebook.com/mejeff.younotjeff>   |   LinkedIn
<https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often miss
messages here)   |   Github <https://github.com/jeffreybenjaminbrown>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170810/870605cc/attachment.html>


More information about the Haskell-Cafe mailing list