hemanth / functional-programming-jargon

Jargon from the functional programming world in simple terms!
http://git.io/fp-jargons
MIT License
18.59k stars 1.02k forks source link

Option elaboration #125

Closed stereobooster closed 3 years ago

stereobooster commented 7 years ago

If we explain Option as union type it would make sense to state that:

Option = Some<Type> | None

But given JS code has nothing to do with types, it is rather explains Option as monad (Maybe monad in Haskell classification).

jethrolarson commented 7 years ago

I don't like focusing on the Monad interface when describing types. You don't say The Array Monad, The Promise Traversable, the Task Applicative. Emphasizing monad just makes the concepts seem scarier.

Sorry for the rant

On Tue, Nov 22, 2016, 8:06 AM stereobooster notifications@github.com wrote:

If we explain Option as union type it would make sense to state that:

  • Some higher order type e.g. type that can wrap other type
  • None is unit type whose only value is None

Option = Some | None

But given JS code has nothing to do with types, it is rather explains Option as monad (Maybe https://wiki.haskell.org/Maybe monad in Haskell classification).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hemanth/functional-programming-jargon/issues/125, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB-4JM0N3oA8quJWwQLmLbH9DS5iJLwks5rAxLngaJpZM4K5nX1 .

stereobooster commented 7 years ago

I'm not a fan of monads myself, but the code example is about monads and not types (that is my point). Offtopic. Just in case it wasn't clear or something wrong with my wording: I'm not criticising this work, just trying to make it better.

jethrolarson commented 7 years ago

No, I get you. I was just having an argument with myself. I think I put option in the document to give a more useful example of chain/bind since array doesn't really illuminate what it's good for

On Tue, Nov 22, 2016, 11:08 PM stereobooster notifications@github.com wrote:

I'm not a fan of monads myself, but the code example is about monads and not types (that is my point). Offtopic. Just in case it wasn't clear or something wrong with my wording: I'm not criticising this work, just trying to make it better.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/hemanth/functional-programming-jargon/issues/125#issuecomment-262446235, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB-4MIaRJ9FwTNDb4wGHgl3b0-CRAjQks5rA-ZSgaJpZM4K5nX1 .