It seems that you know Haskell but don't have too much experience with typescript :) like why would isLeft be defined on any instead of on Either<A, any>? Or why do you need Pair<A, B> defined as object when there's perfectly fine tuple type already in typescript [A, B]? :)
Learning & using Typescript has been like learning Sass: A cool extension to a language I already know, and whose features I discover a bit more of each time I use it. So I actually didn't know about the tuple type, thanks for pointing that out!
As for isLeft, I want to say that I saw that signature / pattern while I was researching discriminated unions and somehow thought it was required. Again, thanks for the tip.
you can see that person is just starting with typescript by amount of any in their code :) I was curious with idea though (because I come from language with pattern matching and I miss it) so I played with your code a bit and tried few ways of implementing it gist.github.com/JLarky/914006843b4...
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It seems that you know Haskell but don't have too much experience with typescript :) like why would isLeft be defined on
any
instead of onEither<A, any>
? Or why do you needPair<A, B>
defined as object when there's perfectly fine tuple type already in typescript[A, B]
? :)Learning & using Typescript has been like learning Sass: A cool extension to a language I already know, and whose features I discover a bit more of each time I use it. So I actually didn't know about the tuple type, thanks for pointing that out!
As for isLeft, I want to say that I saw that signature / pattern while I was researching discriminated unions and somehow thought it was required. Again, thanks for the tip.
you can see that person is just starting with typescript by amount of
any
in their code :) I was curious with idea though (because I come from language with pattern matching and I miss it) so I played with your code a bit and tried few ways of implementing it gist.github.com/JLarky/914006843b4...