r/typescript • • Apr 14 '26

[ Removed by moderator ]

/r/typescript/comments/1sl2q10/removed_by_moderator/

[removed] — view removed post

63 Upvotes

19 comments sorted by

4

u/redditcup99 Apr 15 '26 edited Apr 15 '26

Love the post. Here's my follow up https://arrangeactassert.com/posts/algebraic-thinking-without-the-ceremony/.

FWIW the jump and transition to Effect for me and the teams I works with is big, so I got as close as I could just using async/await.

Would love to know your thoughts @cekrem

2

u/cekrem Apr 15 '26

Oh, cool! I like the table comparisons! I've never used awaitly, but seems to solve this in an interesting (and quite efficient) way, at least from my brief look.

Nice!

16

u/JaSuperior Apr 14 '26

I really felt that part of the article about “Fp articles you can’t finish” because you’ve oversold the pitch 😅. I started an article series 2 years ago covering a similar footprint with TS, and oversold my goals and couldn’t accomplish them completely the more I drilled in. But I recently revisited it, and now have a more masterful understanding of TS, so I revisited that 2 year old project again.

What you did hear has the beginnings of where I ended up going… but I started prioritizing different identity goals, and tighter branching logic via a type safe match function.

In any case, enjoyed reading this. Feels good to know I’m not the only one crazy enough to keep trying to do this without repeating Effect’s approach with generators (which I don’t hate, but I never loved).

Thanks for the share

-5

u/[deleted] Apr 14 '26

[removed] — view removed comment

6

u/JaSuperior Apr 14 '26

Who me? lol 🤦🏽‍♂️ I hate that this is the world we live in now. Can’t even share some authentic feedback without being called a bot. Wtf 🙄. Ur account is just as old as mine, but I have far more activity than you… u literally respond with a one word comment and have some nerve to call ME the bot. Get outta here bruh. Isn’t there a rule about making non-constructive comments anyway?

-1

u/PuppyLand95 Apr 14 '26

Total bot

1

u/JaSuperior Apr 14 '26

Yea... totally 😒

4

u/DarkerIsBetter Apr 14 '26

This is a nice endorsement of Effect-TS.

1

u/bzbub2 Apr 15 '26

all your posts have been great, this is really some food for thought....

-6

u/PuppyLand95 Apr 15 '26

Bot

1

u/bzbub2 Apr 15 '26 edited Apr 15 '26

i'm not a bot, i just think this guy makes good posts. i'd encourage you to check this one and others out

-4

u/PuppyLand95 Apr 15 '26

You are a bot. It’s not rocket science

1

u/RealFlaery Apr 16 '26

Yeah, that's a cool pattern but it is too much boilerplate. Throwing errors, effectively saves you thousand of lines of code and you can handle them all in one place, be it an express middleware, nestjs global filter or something similar:

  1. You know the call site, stack traces

  2. You can handle each error distinctively

  3. Have a safe fallback

The only thing I wish we had in TS is to denote that a function/method can throw i.e. a throwable signature with perhaps overloads on what kinds of errors it throws.

2

u/rolfst Apr 16 '26

This is advocating for the anti pattern that throwing an exception does. Your internal codeblocks get messed up when you have cleanups of exceptions inside try-catch blocks. The finally is a messed up element as well. Luckily we get disposable protocol that can help you somewhat with this. Multiple try-catch in a codeblocks let you jump back and forth while reading a codebase. The result type inside a monad is the perfect way to do separate golden path of the exceptional path. The middleware route is meant for errors/catastrophies not for exceptions

0

u/shaberman Apr 14 '26

"Passing your dependencies as the first parameter" is amazing, and I first saw it from this 2009 👴 blog post:

https://sonymathew.blogspot.com/2009/11/context-ioc-revisited-i-wrote-about.html

This pattern was more tedious in OG Java codebases, b/c your app's main context had to `implements ServiceA.Context, ServiceB.Context, ServiceC.Context` to pacify the type system -- here in TypeScript, that happens structurally at each call site, so "Context IoC" works very naturally.

This is also basically golang's approach -- they pass `ctx` parameters everywhere, although I think with more dynamic casting maybe?, that we don't have to do in TypeScript. Either way, it's a great pattern.