Module VS Object based ADTs #1906
Unanswered
sahilsehwag
asked this question in
Q&A
Replies: 1 comment 1 reply
-
If you put all methods on an object you cannot tree-shake away the methods your program doesn’t use. This might be of interest: https://dev.to/effect-ts/the-case-for-ts-18b3 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am planning on implementing a functional library in another ecosystem instead of javascript. I know fp-ts is built by pretty serious FP veterans. I would love to know their detailed reasons as to why they went with first approach.
Context:
I would love to know your reasoning/rationale/thoughts behind these 2 approaches, and If there is a way to implement this form of polymorphism, if I go with the module based implementation. And In your opinion, if the second approach would make more sense in an untyped language.
I would love your input in terms of design considerations, ie if there is any inherent benefit when considering expressive power that module approach has over object approach ie if there are certain things that we could not just achieve using object approach.
Thank you for your great work in TS ecosystem
Beta Was this translation helpful? Give feedback.
All reactions