Skip to content

Instantly share code, notes, and snippets.

@sgraf812
Last active August 29, 2015 14:16
Show Gist options
  • Save sgraf812/8ef9d2447952ea621c76 to your computer and use it in GitHub Desktop.
Save sgraf812/8ef9d2447952ea621c76 to your computer and use it in GitHub Desktop.
Elm apply operator naming suggestions

Which canonical name for the applicative apply operator?

Criteria

  • Semantic usefulness in different applicative contexts such as: List, Maybe, Signal, Random, Promise, Parser
  • Readability in different applicative contexts
  • Name clashes
  • Semantic hints at sequential notion
  • Relatedness to andThen and map
  • Signal to noise ratio of the name (e.g. how much semantic is conveyed wrt the length of the name)

andMap

Pros:

  • works well used together with map (fn `map` this `andMap` that)
  • hides sequential notion which is actually good for when it isn't relevant

Cons:

  • hides sequential notion so may not be suitable for Parser and Promises

andAlso

Pros:

  • blends quite well with List, Maybe, Signal, Random, especially Parser. Promise is OK, too
  • does not clash with any function I know of
  • resembles andThen from the PoV of nomenclature, combines well with map
  • suggests sequential execution, though not as clear as andThen

Cons:

  • suggests sequential execution, though not as clear as andThen
  • the "also" part doesn't add any significant meaning
@kasbah
Copy link

kasbah commented Feb 27, 2015

Not sure how forking works on gists but here is my fork with edits: https://gist.github.com/kasbah/2784affbaeba9be89769

@sgraf812
Copy link
Author

It seems like PR and pulls in general are impossible... I just c'n'p what you edited. Thanks!

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