paldepind / union-type

A small JavaScript library for defining and using union types.
MIT License
478 stars 28 forks source link

Tutorial to grasp the rational behind union-types #57

Open karlhp opened 7 years ago

karlhp commented 7 years ago

Does anyone know a good tutorial to grasp the rational behind union-types so that I understand the problem they solve? I know basic functional programming with Ramda but would like to learn more about functional-frontend-architecture with flyd. Thanks

ericgj commented 7 years ago

In terms of "functional-frontend-architecture", AKA the Elm Architecture, check out this section of the Elm guide. The syntax is different but the concepts are the same.

A more general tutorial I found useful, particularly coming from OOP: A functional approach to Domain Driven Design. It's F#, so again the syntax is different, but many of the concepts are the same. The bit about union and product types starts around slide 49.

karlhp commented 7 years ago

Thanks @ericgj, this is very helpful!

igat64 commented 6 years ago

Great article about sum (a.k.a. tagged or discriminated unions) types.

brucou commented 6 years ago

https://medium.com/fullstack-academy/better-js-cases-with-sum-types-92876e48fd9f