Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Custom Type Naming Convention (hope I can gist search this time; wrote it before)

In a type specific module, we can name succinctly

module Channel

type Channel
    = Alpha
    | Beta

other code will reference like such

otherModule : Channel.Channel
otherModule =

in a shared/container module, it's usually better to namespace variants

module Communication 

type Channel
    = ChannelAlpha
    | ChannelBeta

-- and avoid conflict 
type Callsign
    = CallsignAlpha
    | CallsignBeta

other code will reference like such

otherModule : Communication.Channel
otherModule =

even if we had let type Channel win and keep the succinct Alpha name, and only namespace type Callsign = CallsignAlpha | CallsignBeta, when other code references Communication.Alpha it would've been ambiguous anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment