Skip to content

Instantly share code, notes, and snippets.

@kasbah
Forked from sgraf812/Suggestions.md
Last active August 29, 2015 14:16
Show Gist options
  • Save kasbah/2784affbaeba9be89769 to your computer and use it in GitHub Desktop.
Save kasbah/2784affbaeba9be89769 to your computer and use it in GitHub Desktop.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment