well-ironed / fe

Functional Elixir
MIT License
40 stars 3 forks source link

Add Maybe type #1

Closed studzien closed 6 years ago

pzel commented 6 years ago

Looks good, although I do have a couple reservations:

  1. Maybe.new seems arbitrary -- while I understand that its role is to bridge the gap with existing Elixir libraries, nothing about the name tells us that it maps nil to :nothing and everything else to {:just, the_thing}. Especially pernicious is accidental double-application, where Maybe.new(Maybe.new(nil)) gives us {:just, :nothing}, when the intent could have been something else.

  2. Functional Bits is also a bit of a weak name, in the sense that it might lead people to think it's: a) a more functional (i.e ergonomic) version of Bitwise ? Something for bit manipulation? b) FB -- something made by facebook? A facebook API interface module?

Let's get together and discuss naming. Maybe something like Functional Elixir? A quick search shows the name is free, and we get a nice logo without any extra effort: the entry for Iron in the periodic table ;) https://proxy.duckduckgo.com/iu/?u=http%3A%2F%2Fsciencenotes.org%2Fwp-content%2Fuploads%2F2014%2F10%2F026-IronBW.png&f=1

3) It would be nice to perhaps start from the interface (Functor protocol) and work up from there? Thinking from this perspective also gives us the opportunity to hook into other protocols, for example the following should hold:

Enum.map(just(2), &(&1  + 3)) == Functor.fmap(just(2), &(&1 + 3)) == Maybe.map(just(2), &(&1 + 3))
studzien commented 6 years ago
  1. I was thinking about a better name for it, but couldn't come up with anything good. Does from_term make any sense?

  2. I like Functional Elixir

  3. Sounds good. How about introducing the protocol when we have another type? Perhaps Result.

pzel commented 6 years ago

Let's stay with new until we figure something out. Agreed on all the other points. If you want to change the reponame/mix definition, I'm on board ;)