Skip to content

Applicative Functor

Pre-release
Pre-release
Compare
Choose a tag to compare
@expede expede released this 12 Jan 08:52

Applicative Functors are here!

Things to note:

  • wrap (i.e.: pure) & apply are here!
    • Operator for apply: <<~ and ~>>
    • Reversed operator arrow direction for consistence with Elixir
      • ie: in Haskell we think about applyping "over" things (apply [(+1)] [1,2,3])
      • In Elixir, we're piping thing into the application ([1,2,3] ~>> [&(&1 + 1)])
      • Can still write in the Haskell order, with reversed operators:
        • Haskell: (\x y -> x + y) <$> [1,2,3] <*> [4,5,6]
        • Elixir: &(&1 + &2) <~ [1,2,3] <<~ [4,5,6]
  • Have to exclude Kernel.apply for modules
    • In the future, we will either need to create a use, or rename apply (probably the later)