0:01Not too much now. I don't want I don't want anyone to be emotionally bruised. Just to All right, here we go. There we go. Pop it out. There we go.
0:34All right. Beautiful. Just wanted to make sure I didn't have anything oopsy daisies on my screen. Hey, number two. How are you guys? Hey, uh, North Rock. Appreciate this. Affect this. Oh, dude. I'm going to affect it so hard. How are you guys doing? Huh? Hey, Brian. Say hi back. Say hi back.
0:51All right, let's just keep it emotionally underwhelmed. This is That's all we're doing here. Uh, how are you liking? I've been on it for a while.
0:59Uh, who is this dude who looks like their mother?
1:04You keep your mouth shut when you're talking to me, boy. Okay. My gosh. My gosh. Finally, some peak content. Uh, no. Uh, we should start a lesson with grammar and the difference between uh effect and effect. How about no Scott? Hey, thank you. Crazy. Appreciate that. What is EffectJS Prime? Thanks for recommending Odin. Uh, come close to having a rebuilt the start menu for Windows. Oh, that's nice.
1:40I love you. I love you too, buddy. Let's go. Learning stream. Yeah, camera focus.
1:44Oh, am I out of focus? Am I a little bit blurry?
1:50Thank you. I would not have noticed. Now I notice started using a neob me. Okay, nice. There we go. How can you motivate yourself to learn a library when faced with AI? Uh because you still have to know how to use AI.
2:14Uh I should be watching on Twitch. You should be watching on Twitch. How often do you uh get your mullet done? Not that often. I need to get it done. Probably once a month. Twitch wants me to have a great bell, a great ball.
2:29How do you use AI to create something with EffectJS or actually learning?
2:32Well, that's what we're going to do, dummy. Uh SCA PB.
2:38All right, we're going to just do some really simple things. Okay, so first off, uh I think there is an effect. Uh what is this one? Let's see. Uh get poll. Let me just make sure that this is what I think it is. All right, fantastic. Let me just make sure we have our package chests on. Uh, isn't there supposed to be like a version?
3:00Is there no version anymore in this?
3:04How do I know what version it is? Isn't there usually some sort of um is Let's see. The main branch contains V4 development. Nice. Okay, good. That's all I wanted to know. Okay, perfect, perfect, perfect, perfect. I wanted to have that thing just, you know, just in case. Uh, we don't need a get a net, do we? Maybe we do. Hold on just one second. T just sending me.
3:39All right, there we go. Uh, now hold on just one second. Oh my gosh. Oh, what did just happened?
3:49I touched my monitor and then it Oh, it it just got all it got all wonky. Don't do that. All right, so let's get started on this bad boy. So, the very first thing I want to do is I want to look up effect v4. All right, we're going to just start looking at this bad boy and just start understanding all these things because I just want to kind of get like the basics of effect. Okay, after years of experimentation, community feedback, and iteration, Effect V4 is officially out uh in beta. This is by far the most ambitious set of changes we've ever made to effect in its ecosystem. We're
4:18excited to get into your hands. You can install today. That's right. Effect v4 is accumulation. Blah blah blah. Faster runtime, leaner bundles. All right. Fantastic. I don't care about those things. Okay. Fantastic. Give me some give me some things to go look at. Many pre Let's see. Many previously separated packages have been consolidated into a core effect package. Okay. All right. Fantastic. Now lives directly inside of effect. Fantastic. Okay. So that makes it easier. Unstable modules.
4:44Uh let's see accessible by this one. Import paths in V3 delivering new functionality meant creating new packages which then men you have the discover, install and keep in sync. In V4 new capabilities ship inside the core effect package. Okay, nice. V4 ships with 17 unstable modules covering HTTP, AI, schema, squeal, RPC, CLI, workflows, clustering, and more. Okay. Well, those are all words I like. Like I like all those individual words.
5:16So, so now that we have that, I actually don't even know where the uh getting started is. We're going to have to do a little bit of getting started. I I heard you say a few times that you might want to use Whisper Flow. Yeah, I'll I'll do something with that. I'm not too too intense with that. Uh God bless Prime.
5:36Get more views. Well, thank you. How Oh, wow. In fact, uh did he start? We're just starting right now. I just want to kind of understand this. Do you feel that programming with AI agents is kind of boring? It can be.
5:48It's definitely not as fun as typing on a computer. You know what I mean?
5:56Let's see. So, I assume this is V4.
5:58Nice. Okay. Uh, blah blah blah. I already know why effect, right? Typed data, untyped programs, right?
6:04TypeScript is excellent at describing your data, but it knows almost nothing about your programs. a function signature doesn't tell you what it uh tell you what can fail. Let me turn off this. Oh my gosh, this song just makes me so pumped up. I don't know what it is. Tell me it's not just the best. I know. All right, anyways, let's keep on going.
6:38Use AI to learn. Come on, man. No, you read. Sometimes you just read docs. Don't be a dummy because sometimes you miss small concepts. It's kind of like when somebody goes really fast through math because they're really good at it, but they miss small concepts and then all a sudden they find themselves up against an impenetrable wall because they've like missed so many little things. I'm just trying to avoid the missing a bunch of little things.
6:59So, all this makes sense, right? You just don't understand like this is like the classic problem with Typescript and they refuse uh Typescript uh throws, right? All right. This thing has been something that's been going on like forever forever and they've talked about it. It's a TypeScript issue. It's still probably my guess is an open issue at this point.
7:23Closed is not planned, right? So any sort of like, hey, by the way, this thing does a thing.
7:29It doesn't have any pro any notion of a throw happening. So that's always been super annoying, right?
7:38All right, let's see. Okay, so blah blah blah blah blah. Let's see. Build for an era AI. Uh let's see. In the AI uh era raises the stakes when coding agents write a growing share of your software. The bottleneck moves from writing code to trusting it. Effects makes the programs uh better. Okay, fantastic. Yeah, that's because you have more stuff coming out out the box.
7:58All right. So, let's start with the core idea, right? Your learning path. All right. Let's start here. There we go.
8:08Let's do some reading. The effect type is the description of a workflow or operation that is lazily executed. Okay. So, that's obviously different from a promise. If you're not familiar with the promise, just in case uh for those for those rookies among us, uh let's go index.ts.
8:24Jump in here. If you go uh function fu and inside of here you return a uh promise of it doesn't really matter what it is right if you return new promise right okay this fantastic uh this thing executes uh greedily right away speedily where where's my vad where's my vad where's my vad right this thing right here that thing right there it executes right away so your constructor
8:52always executes right away So, that can be a bit of a problem, right? Sometimes you don't want your constructor to execute right away, right? Can Am I right, boys?
9:02Prime gives another hand job. Oh, we're about the hand job so hard right here. Uh, this means that when you create an effect Oh, speaking of hand jobs, I got to go to Twitter. Dude, that was the most insane statement I've ever made. Dear interns, it's time to learn. Get your brown bags out. It's a lunchon and learn.
9:34Did that one backwards?
9:37There we go. The startup post. Oh, quick uh quick community check. Community check because I always forget about doing this people. There's a lot of naughty people that post in in here.
9:50Get get out of here. I don't want stupid comments. Get out of here. Get out of here. That's stupid crap you're posting. Get out of here. Big box. Sweet. I'm going to let him go. Are you an AI vegan? Don't even know what that means. I'll let that go. Okay. Honestly, I'll let that go. Emil, you're lucky. Ban him. Bring your own brown pants.
10:30All right, X. You're up. You're up, baby cakes. Okay, so let's get back here. Let's make sure. Uh, all right. Fantastic. All right. Sorry, I had to send off a message on the other the other keyboard. All right. Let's go back to this. All right. So, okay. Here we go. This is the general form of effect. Effect effect success error requirements.
11:07Interesting. Okay. This type indicates um this type uh indicates an effect the succeed or return value of type success fails with error error type may need context uh contextual dependencies from requirements to execute. Okay. Okay. Okay. I can immediately see here. Hold on. I can immediately see uh first off dick and balls just in case anyone's wondering. But also I that's good. Okay.
11:34So that means that any effect must be able to take in a previous output of an effect. I'm not sure what the requirements are, but that's where my head's kind of going right now where I can have an effect down here that its requirements like, hey, I need A, B, and C to be able to do something here. That's how I currently look at that.
11:53And so that way if any of these die, then you shouldn't execute this one. That's kind kind of how I currently think of it, right? You know, just walking through this slowly. The star.
12:01Yeah, thank you. What is he drinking?
12:03Uh, this is water. I like to make guesses in my head as I read so that way I can kind of like make a guess as to what it could mean and then when it tells me what it means, it's nice. All right, here. Let me turn on B. Oh, no. No bodies today. No bodies today. No TTS. We're learning.
12:21However, effects are not actually functions. They can model synchronous, asynchronous, concurrent, and resourceful components. They're computations. Immutability effect is a val. Let's see. Effect values are immutable and every function in effect library produces a new effect value.
12:37Modeling interactions. Those values do not perform any actions themselves. They simply model or describe effect effectful interactions. All right. An effect can be executed by the effect runtime system which interprets it into an actual interaction with the external world. Ideally, this execution happens to a single entry point in your application such as the main function where the effectful operations are initiated. Okay.
13:05Okay, cool. So, that means really this whole big chain that they're talking about, what they're really saying is that the only place you do something like, you know, I don't know what it's going to look like, but something like effect.run should be in your top level thing. And then it will go through build up your tree and execute everything through.
13:25Bro, uh, this has generator functions. You know, I have never really generated functions too too much. Uh, Grock, why what am I going to chat? I don't need to go I don't need Astra to tell me what a generator function is. Remind me star yield versus yield in uh, JavaScript. I can't remember the differences. I think star yield returns all the results from the generator, but I can't remember.
13:52Okay, both only work inside of a generator function. That's fine. Yield pauses the generator to produce one value. Okay, fine. Okay, that makes sense. Yield delegates to another iterable or generator. It walks the thing and yields uh each of its values as if they're written in uh this generator. Okay, so yield result it gets the inner which is AB done and then this thing gets okay. Okay. And so this would be AB done 10 20.
14:26Okay. Okay. That makes sense. So this gets everything. So how does this yield work? Does this return an array every single time? That's actually something I don't know about generators. Is this an array of all the different values combined?
14:40I don't know. I've never really generated much. Right. Okay. I've just never really wanted to. Hey the Well, hey Bruce. How you doing?
14:50one value at a time. No, that can't be it because the output right here is this. So, that can't be it either. Let's see. The return value of yield is what you put uh put as a resume argument in next. Okay, that didn't help me.
15:10Thank you. You kind of don't need to learn generators for effect. Well, I just want to know the basics of what a star. So, that's okay. So, there's something I'm going to have to go learn about. Uh, give them X. Run XS in my place until it's done and then continue. See, so it runs it gets everything.
15:29This is I I do have to say now that I'm looking at it, now that my eyeballs have finally looked on generators, I do have to say this feels like stupid syntax. Okay, I know it's not. I'm sure someone's going to explain to me why it's actually not stupid syntax, but yield being yield out and yield star being like pull it in. It just seems
15:52This seems so It seems so stupid. Okay, collect. Okay, that's fine. It's collect. Okay, cool. Super duper super awesome. Big f big happy. Many happy. Sorry, my my phone is exploding.
16:09I was in the middle of doing something very important when I got cut off on the old uh cut off on the old cursor. See, it says I have an unpaid uh invoice, but I don't believe that's true. There we go. Okay. I said, "Hey, set this thing up so I could have a project with it, but I don't want I actually don't want it to do that anyways." Okay, that's good. Now, I got I got to just make sure that this is all actually executing still. Hold on. You're gonna have to You're gonna have to wait for a second.
16:34Are you still executing?
16:37All right, good. Because I'm doing this thing where uh I'm actually testing how successful agents are at running uh desktop operations. And so GPT56 Luna none fast is over 50% successful at signing into a computer and getting to a uh going into the whatever screen into the lock screen and then back out. Interesting, right?
17:01These are real tests. See, notice that we're doing some real tests here. All right. Awesome. Okay, so let's get back to this thing. Let's get back to this thing. Where are you? Where are you? Where are you? All right.
17:14Immutability. Effect values are immutable and every function in the effect library produces a new effect value. Okay. Uh these values do not perform any actions themselves. They simply model or describe the effectual interactions. Okay. Uh execution effect can be executed by the effect runtime system. All right. Let's see. Typed params success. It represents the type of value that the effect can succeed with when executed.
17:39And this type parameter is a void. It means the effect produces no useful information. While if it is never, it means that the effect runs forever. Okay. Represents the expected errors that can occur when the executing. Let's see. When executing an effect. Okay, this makes sense. If the type is never, it means that the effect cannot fail because there's no values type never.
18:01True. uh requirements represent the contextual data required by the effect to be executed. This data is stored in a collection named context and if the type parameter is never it means the effect has no requirements and the context collection is empty.
18:20AER success area error error error area and R for context. Okay.
18:30requirements. I What is A?
18:33See, I get the I get the E and the R, but what's the A? Shouldn't it be S? S E R, sir. Extracting inferred types by using uh utility types such as success, error, and services. You can extract the corresponding types from an effect.
18:48Okay. Grab effect, some context, context, service, some context, this thing. I don't really understand what we're trying to say here. was a class with no properties that extended some generated class in the moment because you can return classes right
19:05can you can't remember uh here futu right you can you can do this here let's go like this return class you know uh x number
19:25Okay. So, you can It's an anonymous class. Okay. So, I thought that's what I thought. Okay. Super duper. See, these are things I forget. First class. First class citizen. Honestly, a first class citizen right there. True.
19:40This seems like cursed syntax. I just want to throw that out there. This seems absolutely evil, but I'm going to let it go because everyone keeps telling me effect truly is the best. Assume we have an effect that succeeds with uh a number, fails with an error, and requires some context.
19:58An effect success type of program. Extract the error type effect air type of program. All right, there we go. Extract the context type which some context. Okay.
20:23There's that A again. That A really just throws me up. Okay. So, I I don't really understand. I don't currently I don't really understand what the heck's going on here. So, these are all types that it's extracting. Okay. By the way, TypeScript, what a cursed language sometimes. Okay. Fantastic.
20:38This was a great I I do understand some things. Okay. So, you can even extract types out of stuff. You can do some type masturbation if you need to. Boys, I don't know if we're ready. Okay, boys. I don't know if we're ready, but I'm ready to do a little bit of type masturbation with y'all. Okay. All right. So, let's go into creating effects. Well, let let me just make sure I have the right learning path.
21:11Do I go Getting started installation. Okay, that's fine. Hey, we need this TypeScript. That's fine. TypeScript 7 is recommended for best performance. We don't use node because we're not losers. Okay. Compiler options strict. True. Oh, I love it. Oh.
21:34Oh man, we're so strict. NPM install that. Okay. NPM. Oh, but install effect at RC. Beautiful. There we go. Do we have anything else? TSC and netit. Oh, yeah. We got to do that. npx tsc tscit. I think I already technically did that by already having one. Uh, I can't even read that. This is not the command you are looking for. Oh, I don't even have it installed. I got to do this as well. Bunit.
22:14All right. Bun install TypeScript server. Is that what it is? No, just TypeScript. There we go. Do one of those. Uh, what is it? Bun X.
22:27Okay, perfect. Awesome.
22:31Get that all installed. Touch door. Okay, dude. I'm ready. I'm ready to touch. Dude, I'm ready to touch some dirts. Honestly, boys, I'm ready. I'm ready to touch some ders. Uh, source index.ts. All right, we got all those things. Open this thing with the following code. All right, we got console. Let's Let's just do a little man let's just do a little uh, you know, manual manual typing.
23:02Am I doing this wrong?
23:06It wasn't autocompleting.
23:09All right. Well, fantastic. So, we get a program which is a console. We'll do the capital C console log. What the hell is that? Is that a type? const program equals console log. Hello world. All right. Fantastic. Oh, is it going to do that thing here? Let me just rerun it cuz sometimes, you know, uh, bun install.
23:42Oh my gosh. Oh my gosh. I hate this part. Um, make the project work. Oh my goodness. I'm impersonal. I'm impersonal, people. I'm impersonal there. Let's do this again. Uh, make the typescript project just work. It won't see uh effect. Fix it, please. I dude already asking, dude, I'm not going to do project initialization. Okay, there is nothing there is nothing worse in the universe than freaking
24:23TypeScript and and some of its things it does. Okay, so someone's saying erase the TS config. I'll just do that and go bun an uh blank blank.
24:40Well, that better worked. Okay, tough guy. Okay, you're you're you're lucky it did work. Stop it.
24:58Yeah. Yeah, I said that. Yeah, I said that. Yeah, I said that. That one chatter sucks. That's who you are. That's you. You're big suck. You suck. You suck on it. Um, okay.
25:11Uh, we can run sync. Okay, cool. So, we can just run sync. Um, so let's like this. Let's do a little uh function. Uh, let's go run. Let's put in this bad boy so we can really see it. And then we'll go not that one. We'll go effect.run program. Do one of those. Uh what is the problem here? Run sync.
25:29Uh sync. Oh man, I just love it. Uh set timeout. Run one of those. There we go.
25:39There we go. Do one of those. And then go bun run index source index. Nice. Okay. Fantastic. So, we did just see that this ran, but it took a second to run because I put this bad boy right here. Okay. So, we're starting to see it all. Okay. Good. Fantastic. Do one of those guys. Blah blah blah blah. Dino.
26:03What the What the hell is Dino?
26:15Oh my gosh. All of this just to run a program. All right. Now, let's write and run a simple program to ensure that everything is set up correctly. Uh, open up open the source ax. Wait, wait. What is this thing? Hold on. Hold on. Was there some sort of Oh my gosh.
26:35I don't want to do this. Vide plus React. I don't want to do that. I don't want to do that. Let's just go to creating. Let's just go Let's go into here now. I don't want to do TypeScript and invite and all that alto together, please. All right, my learning path. Let's go back to my learning path.
26:55All right, I did this one. Set up your project. Write your first program. There we go. Creating effects. Nice. Why not throw errors? Well, I already know why.
27:03Because they suck ass to throw. Who's get Who carries the boats, fellas?
27:11this 97y old developer still writes code the old fashioned way to tell you the honest truth why uh I do that just so everybody understands why it's important I know this one guy's uh likely memeing um let's go with client uh client main okay so this is the code that was generated I went and got TJ's big like hey how exactly effect should work I don't know what the hell this does and I don't like living in a world where I don't know what this does like I understand that this thing is going to
27:41have some uh linear commands and stuff in it, but I don't like this. Okay. Like I I don't like how this I don't I don't like not knowing how these things work.
27:51You know what I mean?
27:54Uh just go to effect institute. Okay. Yeah. Let's try that bad boy. I'm glad to try out this bad boy.
28:02All right. Oh my gosh. Ah, how do I go?
28:06Kit, help. You're going to really make me sign in. Kit, you son of a All right, Kit Langton, you can get your little Ooth inside of me.
28:21By the way, I I will have to say this new idea that people have been doing where this does not produce a pointer effect anymore. This is kind of like a new design cutting edge thing where people say like, "Hey, you don't need to you don't actually need a pointer." I hate that. Just in case you're wondering, in case you're listening, kid. Um I think it's I think K. Okay, that's fine. That's fine.
28:51Welcome to the Effect Institute. I am Kit and I want to teach you effect. But first, the briefest tutorials. Pressing the space. Well, uh, as you may have discovered, will play or pause the current section. Yep. Yep. Yep. Yep. Institute. Okay. Thank you.
29:08Well, I don't want to have to do that.
29:10Wow, you actually did it. As a prize, you get more tutorial. The R key will restart the current section, and this this key will jump backwards and forwards a couple seconds. Oh, interesting. Okay, finally, there's a settings button on the top of the screen. That is where you can control the playback speed as well as the file feedback. All the feedback is appreciated. This is very much alpha software at the moment, so please bear with me. I'll continue to add lessons and superolous animations until I die.
29:37Now, let's become a fact build. Oh my gosh, I hate this fact that I can't just scroll down once. All right, behold a checkout function returning a promise order. Internally, it calls three more async functions. What will happen if we call it? We don't know because any of those things can die. The problem is fractal, of course. Our call to get card presumably returns a promise card, which is just opaque. Blah blah blah blah blah. We already know how this all works. It could fail. Blah blah blah blah. So, how do you deal with exploding promises? Uh, you wrap your code in a try catch block. Tragically, the error you catch is always a type of unknown,
30:06which is a little of help. Uh, to handle it, you must pattern match, guided uh by what you've learned through prior code. Splunking. Alas, the type checker will not warn you if your assumptions were wrong. Yes, we all get I I assume everybody understands why this sucks ass.
30:20Okay. Uh, in future commit returns an empty cart instead of throwing an invalid cart error. That branch becomes dead code. If a new error case is added to your catch block isn't updated, congratulations. You'll now be paged at 2 a.m. Yep, that's why it sucks. The promise is broken because it is entirely disregards a fundamental aspect of all earthly programs, the manifold ways in which they might go south. This is true.
30:42Type dares. Okay, let's see how this went to a C. Wow, this music, dude. Mario is so intense. I don't want to press P to play animations. Okay, I just want to Sorry, we're we're we're I'm reliving my childhood. All right. See how effective helps us. We write the same function twice, beginning with the promised version.
31:16Slow die rolls a dime, awaits for no reason, and then returns the result. We will then outlaw four and pronounce its rolling to be punishable by death. And if that occurs number has appeared, we will throw very bad roll error.
31:30Nevertheless, it continues to type check. Typescript doesn't care. Our feeble human mind is solely responsible for tracking this, which always sucks ass. I I'm already like I'm a I'm error handling more properly pilled, right?
31:43This already exists in my brain. All right, here's an effect version of slow die. It is still gets a random number. It takes non-blocking, one uh second nap, and then returns the results. Let's make it lethal. If the role is four, we will then fail with our trustworthy very bad roll. And finally, we have a type error. The air is a type propagated from effect fail to the surrounding effect.
32:03We are forced to reckon with it. Welcome to TypeScript. Okay, fantastic. Oh, wait. Do I have to like press P to play it? How do I Oh, see, I have to do this. There we go. Very bad roll. Oh, that's annoying.
32:16All right. Very fantastic. We can do effect failed. We can yield out or we read the generator of effect failed. And then this thing says, "Hey, this no longer works." Okay, that's nice. We get an error. So now we have to do very bad roll. Okay, that's very cool. Love it.
32:32Absolutely love that. That's exactly what I've always wanted in my life. I have one green error. I have one green I have one green square. Well, let's see what happens when we add a second failure case. I've always found uh six to be rather bumptuous. Uh six is my favorite number. All right. Okay, nice.
32:49We can just use a little TypeScript union. Fantastic. Now I have to do this to earn the green square because everybody knows I am addicted to green square. No, don't talk to me, guys. Is it just me or is it just like the moment?
33:08the Swedish uh radio symphony orchestra, which is so good. Right. Fantastic. Don't tell me it's not fantastic. All right. Oh, sorry. The music was way too loud there for a second. I was really into it. All right. Anyways, isn't that a Looney Tune song? No. Shut up. You saw that live. Shut the hell up. You did not.
33:45I don't know, man. If you want really granular error handling, uh, I like the Go approach. Yeah. No, I agree that Go approach uh feels good. Uh, I don't know, monkey. Uh, the Go approach does suffer from a few things, though.
33:57Obviously, um, being able to just multiplex a whole bunch of promises together and having them come out just as like simpler in JavaScript. Okay, I've done a lot of Go. I know I know a lot of go. I KNOW A LOT MORE GO THAN YOU. You know, I know you can air group things and all that blah blah blah blah blah blah blah. It just is easier.
34:13YouTube doesn't hear any music. That's because YouTube will put its boot in my ass if I play music on it. Yes. Uh I would I would argue that it it does make life simpler.
34:28In the Go world, understanding what errors are created are very obvious and straightforward. I do agree with you on that. The obviously naughty thing that go did is they allow panics which you can catch and sometimes apparently in the standard they still have panics. Panics are good. Panics I'm not sure are good.
35:02I don't know. I'd have to I mean, panics are good. If the program cannot move forward, then I agree with it. You look tired. Uh, thank you, Kevin Staples. I really appreciate you. You look like a piece of Um, but I haven't had coffee. Today's day three, no coffee. Okay. All right. Let's keep on going. All right. Now, let's see how effect deals with failures. First, we'll create a safe die. No, stop it.
35:33Just to let you know.
35:34All right, we'll create a safe die. How do we do that? Slow die. Catch all.
35:38Speak for you can do one of those two.
35:41Succeed. Okay, so now you're just erasing. Oh, okay. Now we're just erasing it. Okay, so errors are don't don't matter.
35:48To be better at my craft.
35:50Uh, one by one with catch tag. We target very bad roll specifically and recover with a negative 9,000. Ooh, that's some that is some low aura. And once we do, our error type nar too high remains because we haven't handled it yet. Of course, we can add a second catch tag and handle it too high. Okay, I like this. I like this idea.
36:12That's fine. I understand that it's a Typescriptism to throw a string in there and it's just like, you know what, that string that's actually a class name. I mean, what an ins what an insane language that you can just do that. This is effect V3, not V4, FYI.
36:32Well, then who told me to read this? You son of a Who told me to read this one? Who told me to talk to Kit Lang?
36:41Just mute the tab and it won't talk to me. True. There we go. All right. I do like this. I do like this little catch tag business because it's kind of neat that you can pipe it and do certain operations on there saying, "Hey, okay, there we go. That's what our new thing is. It only allows this to happen." Okay, that's that's cool. I like that. We can also do too high. Okay. Yeah, that makes sense.
37:06Okay, fantastic. That's cool. That's cool. Okay, slow down. Slow down. I like to re No, stop. Stop. Stop. So, you're uh penurious. Penurious.
37:20Extremely poor, povertystricken.
37:22Penurious. Penurious. I don't know that word. Penurious.
37:34Hey, if you're a penerius boy, just say so. Okay. Hey.
37:42If you're a Penerius boy, just say so. Oh my gosh. Mom, I'm watching Prime Live. I know.
37:49Uh Pure, first time I caught Prime in live stream. Yeah. Uh are Panerius Maxine? We are. Hey, you're Penerius boy. Just say so. Okay. If you can't do it. Uh a Panerius Pantheus. That's weird. Uh that's weird that this would be in conjunction with this. His alliterations are a little weird. Um naturally, you consult the LLM console comprised of a tree of obscure star systems and a dung beetle. Yep. Okay.
38:17Okay, that's good. Uh, I would have rather talked to the dumb king from um from Elden Ring. That would have been way better. The dung eater. Uh, let's see. Kicks off all three queries in parallel.
38:30Okay, nice. You can do a little parallel promise all. You do all these asks. You get all this thing return. What could possibly go wrong? Everything. We all know we've already been over this. All right, let's see. No, I I pressed P. P means stop, right? Let's see. Uh, your ass function queries a language model which is flakier and costlier than your average API. True. Uh, what if uh this zubby implodes? Okay. True. Right. Draining
38:58your already uh parched coffers for nothing. Promise strewn code is prone to leak. Yep. Once uh created, a promise will run to completion whether or not they're still required. True. Also true.
39:12That's true. If we wanted to fix this, we'd first need an abort controller, which by the way, abort controllers, am I right?
39:20Abort controllers, am I right? Try a little catch. Abort throw E. I hate by Dude. Oh my gosh. Oh my gosh. I Dude, this this crap is just abort controllers. I will tell you this much. I have like nightmares about aboard controllers. The amount of different places I've had to throw little board controllers in Panerius. Yeah, Penurius. You look Penerius Prime. Thank you. It's an ugly API, but it does the trick. It does the trick.
40:00It does the trick. Right. All right. Now, when the dung beetle is crushed by uh crushed mid reply, the error is caught and the controller is aborted, signaling generated text to stop itself. As the promise doesn't natively support cancellations, we must uh do this verbose wiring ourselves. Man, this song is intense. Okay, lady, you are really singing. But I can't do this. Okay, I just can't.
40:25That's just way too intense. Where's my favorite one? Where's dragon? Where's dragon born?
40:36What comes up next? Legend of Zelda. Okay, we can hang out for Legend of Zelda. Mega Man. Okay, it's just blood Bloodborne is like a little too intense for me. Can we all agree Bloodborne is just way too hot? Like you can't just be getting Bloodborne.
40:57All right. So, this thing this thing crashes, which means that you have to do this aboard signal. Yep. We must do this verbose wiring ourselves. Yep. Which is very annoying. Uh post, let's see. Most production TypeScript backends simply ignore this problem by tolerating and perhaps unwittingly uh the monetary computational cost of leaking everything everywhere all the time. Yep, that's true.
41:19Honestly, I that's that's what I've seen out of pretty much every TypeScript uh back end is that how will effect save us time? First, let's revert the promise solution. All right, fantastic. Uh we can switch ask over to effects AI library. All right, language model generate text. We migrate stockice over to an effect.
41:39All right, there we go. We're going to yield all and that's it. Our text generation requests in parallel. If one of them fails, um, the others are immediately interrupted. This property of the structured of structured concurrency is built into effect. Well, fantastic.
41:56All right, I kind of want to go back to effect four for a little bit because we were kind of in the middle of effect four. So, let's just keep on going, but in the effect in the effect world. Wait, where's my effect world?
42:06Because I want to see what effect for in case it's different. Okay, I appreciate kits, but I don't feel like I'm learning as much as if my hands were on the keyboard. Right. In traditional programming, when an error occurs here, let's just yank this bad boy.
42:22All right. Fantastic.
42:26All right. Fantastic. However, throwing errors can be problematic. The type signatures blah blah blah succeed. Okay. When and let's see. Creates an effect that always succeeds with a given value. This uh use this function when you need an effect that completes successfully with a specific value without any errors or external dependencies.
42:46Okay, this type of success is number never. Okay, fantastic. Fail creates an effect that represents an error that can be recovered from. Use this function to explicitly signal the error in effect. Okay, fail. New error. Nice. Boom. Boom. Boom. Boom. Boom. Boom. Okay, we kind we kind of got that. It never produces a value. Okay, that makes sense. It never produces a value.
43:12It has no dependencies. It just is what it is. Okay. Although you can, let's see, you can use error objects with effect fail, you can also pass strings, numbers, more complex objects depending on your error management strategy. Uh, using tagged errors. Objects with a tag field can help identify the error types and works well with the standard effects things. Okay. So, we create a tagged error with HP data. Do this one. Now, we have HP error. Okay.
43:39Okay. Error tracking. Uh, when effect succeeds. Oh, let's see. And let's see with effect succeed and fail you can explicitly handle success and failure cases. All right, fantastic example the division one. Here's let's see here's how you can rewrite the full divide function using effect making the error handling explicit. All right, so we have an effect. It has a number. It has an error. If b equals z, we do that. Else we do that.
44:04Okay, so what you're trying to tell me before you wrote all that insane code is we're doing a little effect. Now what is it? It's effect.ffect. effect. Oh, it just returns of an effect. Okay. So, we don't do it that way. We go over here and we go effect. Is that what it is? No, it's a generic.
44:24It's a generic. It's a number or a Do we need a typed error? It just has an error. So, we could we could provide our own typed error, but for now, we'll do this. Okay. It's going to return this one. If this is the case, then we'll go like this. This will be a return effect. Uh let's see. Effect reject. Is it reject? No, it's fail. All right. Fantastic. Return effect succeed. Right.
44:58Then I go effect run. Let's see. Something with exit. Run promise run sync exit. Is it just that? How how do you pass these things in? Oh, you actually just do you actually just execute the whole dang thing. Okay. So then I'd go 10 zero, right? And then I could go bun run this thing. Okay.
45:22What comes out of this thing?
45:25It's an exit ID. Exit failure tag cause this thing right here. Failure object. Okay. Very interesting. There you go. Effect is killing me. Is it effect is the name space, right?
45:50It's just this thing and that's that thing. Okay. How's this any different than new promises? Well, it's making the error required path, right? So, you can't have an effect without an error handling situation. This uh clear type signature ensures that errors are handled properly and that anyone calling the function uh is aware of the possible outcomes. Simulating a user retrieval operation.
46:18Let's imagine another scenario. We had effect succeed and fail to the uh to model a simple user retrieval operation where the user data is hardcoded which could be useful test scenario. Yep. Okay. So we have the user interface that's fine. We have a get user which has this new database record. Right. All right. We get the user ID. If there is a user, we do this. Okay. Then we can go grab that. Run sync. Get this.
46:43Let's see. In this example, uh example user which is the type effect user will either produce a user object or an error depending on uh whether the user exists or the mock data. Let's just do this really quickly.
46:56Uh just a little bit of practice just because I still don't really know know all this crap, right? It had a read only name. There we go. I think is what it had, right?
47:09ID uh ID. There we go. Is that what it had?
47:16All right. There we go. Now I don't feel so bad. And it had a get user. What do we Oh, they just wanted with get user. And then we just had an ID, right? Okay. Uh user ID string, right? No, it's a number. do one of these and f this thing.
47:33All right, fantastic. Uh, const user equals users. Nope. Whoa, whoa, whoa, whoa, whoa, whoa, whoa. Consters equals Can I just do this?
47:46Wait, did we do an array? Oh, yeah, it does. It just has them as uh these things. Okay, fantastic. And then let's go like that. Yes. Make that happen. Do one of those. Do one of those. See this. We'll go with Bob. Fantastic. The old classic Allison Bob, right? User ID. Oh shoot. Oh my gosh. You know, do do you guys I you know I I actually like the more explicit stuff right there.
48:24I'm more of an explicit kind of guy. I don't know. It just feels nicer to me.
48:33Why are you being like this?
48:40All right. Fantastic success. Okay. Interesting. Okay.
48:49Interesting. Interesting. Interesting.
48:52And so if I set it to a three, then I should get back to a failure cause. Okay, sub is so old.
48:57Okay, we get the basics now. We get the basics. Prime, how you doing, HD negative? I hope you're doing good. Thank you for the tier three. Let's see. The thing I hate about the effective website, they don't show you examples on how to use it. Well, I mean, they're kind of doing it. Kilobyte, appreciate that. Thank you for the tier 2 kilobyte. Let's see. Oh, wow. This sub is so old.
49:15It wants chat off his lawn. Yeah, I know that is old. Ender, let's see. How can I not infer that the user is uh is record number user? Uh because technically there is no such thing as a record number, right? If I'm not mistaken, there is no such thing as that. So the default usage of this actually is string, right? That's actually what's happening underneath the hood. The real question is why doesn't this air now, right? Like how come this doesn't how come that doesn't air right there?
49:44Well, that's because it can be coerced.
49:46Then the real real real real question is why is that in there? Like what what's going on there? You know what I mean?
49:55I don't like it. I don't like it.
50:04Record is a up type in type.
50:12Let's see. I still need 5K line sample repo to compare this with typical TS version without effect. Yeah. Yeah. Well, that's what I do have. Hey TJ, if you're still here, look at that. Look at that. Look at that new TR. Look at Look at whatever this thing is doing. What the hell is a layer? I don't know what a layer is. Why are we reporting failures? What's a scoped? I don't know. Provide main life.
50:33I don't know what that is. Uh control.
50:38You know what the hell's control doing?
50:40I don't know what controls doing. What about uh server or sorry proxy? What the hell's proxy doing? I don't know what proxyy's doing.
50:50Why do we have a database lives? What's a log? What's a actions? What's a century? What's a config?
50:55It has all the things. I don't know what it did.
51:00But apparently TJ said that this is in fact the best way to build. By the way, the fact that he uses accept goat, there's a red flag. Dude, is it really true?
51:11Why is that? I I'm I'm just following what TJ said to do. And then we have a nice little uh document describing how everything should be built. So, since I don't know what those things mean, and the translation apparently was good, I'm going to now have to learn what it means. All right. Modeling synchronous effects. All right. In JavaScript, you can delay execution of synchronous computations using thunks. Thk is a function that takes no arguments and may return some value.
51:41Is this a JavaScript is is this some modern JavaScriptism? Wow. What the hell is this? How come you get such a big thing? How come you get a full ass gif?
51:53Aren't you the YouTuber that makes great ads? Thank you. I am. HTMX is for serverside rendering. Tier 2 subs. Oh, nice. Hey, tier two, you earned that. I did not realize that that was a thing. Thunks are a computer science thing. Are they really? I've never heard of a thx. I've just never heard that term before.
52:19Okay. To model synchronous side effects, effect provides an effect sync and effect try constructors which accept a th Okay. Uh creates an effect that represents a synchronous side uh effectful computation. Use effect sync when you're sure the operation will not fail. Okay. Uh, the provided function thunk must not throw errors. If it does, the errors will be treated as a defect.
52:40Oh my gosh. This defect is not a standard error, but indicates a flaw in the logic that was expected to be error-free. You can think of it similar to unexpected crash in a program, which can be further managed or logged using tools such as effect catch defect. Okay. This feature ensures that even unexpected failures in your applications are not lost and can be handled appropriately.
53:06In the example below, effect sync is used to defer the side effect of writing to the console. Okay, we have this one.
53:12Yes, we get this that I don't really understand why this is an example. I'm sure there's better. I'm sure I'm just being pedantic, but I just don't even get this. Um, all right, there we go. We do one of those log hello world. Run this one. We get all of this all the way through. Uh, in the example below, effect synced is used to defer the side effect. Okay, fantastic.
53:31We're going to do a little sync here. Where's the sync? Run sync. Okay, fantastic. Well, I mean, I don't see the word effect sync. I just Oh, it is. It's right there. Holy cow, I missed it.
53:42Okay, whatever. Okay. The side effect uh to the logging console encapsulates within the program. Won't occur until the effect is explicitly run. See, running effects. Yep. This allows you to define an effect a side effect at one point in your code and control when they are activated. Improved manageability and predictability of side effects in larger applications. All right. Okay. Sure. Sure. Sure. Sure. Sure. And sure.
54:12I don't quite catch the meaning of this other than don't throw inside of a sink. Don't don't in a urinal. Don't have sex in the champagne room. And don't throw inside of a sink. Okay.
54:31It's as simple as that. You know, it's so true. You got it. Thank you. I get the I get the general idea. Creates an effect uh that represents a synchronous computation that might fail.
54:45Right. Yes. Okay, dude. The classic the classic the classic function that ruins everybody's life. This is this this should be on the wall for like your first server crash is JSON.parse. Who here's first surprising Whose first surprising server crash was from JSON.parse. Me. Everyone gets surprised at least once. Yep. Everyone gets you get one shot at getting surprised once. JSON and his parsing get true. True.
55:32Really? You've never used JSON pars without wrapping it? Wow. Okay. Hey, that's crazy. You're you're a one of one, my friend. You're like the moist critical of programming. In this example, parse function creates an effect encapsulated JSON parsing. The parse input throws an error due to the yep blah blah blah blah blah. Uh it will fail with an unknown error. Okay, interesting. Let's just see that. Uh let's see that in action. Huh. Huh, boys.
55:56Uh return effect dot I already forgot what the function was called. Try and let's go like this. Let's go. Um let's see. Oh, wait. Can you return from this? No, you wait. Yes, you do. Let's see. that I can just go JSON parse. Um, there we go. Beautiful.
56:23All right. Can we like can we log this out a little bit better?
56:33An error curtain effect. Try unknown error.
56:43How come the inside error wasn't caught?
56:44Am I just Am I dumb dumb for not knowing how the inside error was caught? Am I holding it wrong? Right? Because I see the outside error, which is this thing, but the inside error doesn't say anything about jaan. Keep reading. Okay. Okay. Okay. Customize error handling. You may want to transform the cod error exception into more specific errors or perform additional operations when catching an error.
57:11Okay. supports an overload that allows you to catch uh specific errors. Okay, cool. So, I can try and I can catch. O, girl, don't make me don't make me catch.
57:34Wait, did I do this thing wrong?
57:42All right. Type error error is not assignable to to type unknown error.
58:08Uh, let's not do that. Let's just go type. Oh, unknown. Okay, got it.
58:30Holy Is that the primer and huge fan? Am I missing you at TC this year if I go?
58:39Wait, you don't even have to do that, right? Because uh parse is insane function. Yeah, parse is insanity. Okay, so we just caught this one. So I caught nothing. I caught something, but I caught nothing.
59:02Okay. How do I put that in me?
59:07How do I put that in me?
59:14Hey, thank you Elani. YouTube is chat is slow. True, true, true, true, true, true, true, true, true, true. Is this fire code? I honestly don't even know.
59:22By the way, Allejo, is that the primo my little anus protector? Thank you very much. This looks more like misdirected engineering to pave over bad engineering, especially promisor board signature. The run sync is just lazy execution of methods. We're reinventing JS. 90% of my CPU cycles are now managed state machines. What the f?
59:41That's why modern engineering is so incredible. We've managed to avoid real languages in pursuit of more abstractions that make life easier.
1:00:01Anyways, how do I reach Casey?
1:00:03Um, how do you reach Casey? I think you have to study a whole bunch. And once you get good enough, you're finally at the level of Casey. That's how you reach level Casey. But you don't have to reach that high, honestly. Uh, what are you using your scratch pad for? Nothing. Legendary gamedev. Yes.
1:00:26I'm confused by it. It apparently is fantastic. Everyone has very many great things. I I can tell you right away the one obvious selling point for effect is that it forces you to define your errors. And that simple little bit is going to cause a bunch of headaches to go away, right? Because if we have some sort of my assumption is let's go like this. What is it? It's con like error fu equals what is it? It's like class
1:00:53extends uh effect like how do you how do you create custom errors again? Where's the code Casey will just appear in there's some extend function data. I need data brother. I need data. Is it not tagged error error bar? So you take the time and you go like this. You define your errors and I do this thing. I go like this error uh foo or error bar and I do that. There you go. Right.
1:01:44Class class extends this thing. Oh, I did the hole. All right. How do I get the type of I There we go. Oh, fantastic. There we go. All right. So, we have these two.
1:02:06And then this thing will say, well, hey, this thing is broken because you're not handling this. Which means that I have to go in here and I have to actually cast it into the correct errors. I have to be able to say these are the errors that I'm getting because this is saying hey that's not correct these are not being respected and then when I'm actually handling things it will have to be like hey you're not handling those errors so you can bubble up the errors right
1:02:31it's so that you can create a website in which you cannot goof yourself I I believe is the correct
1:02:48Yeah, I don't like that though. Why can't I just return the error? Just because like I'm just like imagining in my head if I want a stack trace, like a proper stack trace or the error that's associated with that, right? Because I like the fact that this thing has this right here, right? This like tells me good useful information like that guy.
1:03:10It's just like, yo, your JSON your JSON broke. Uh because errors are unknown in Typescript. Honestly, don't even know what that means.
1:03:20Tell you the truth, I don't even know what you're trying to say to me when you say words like that. Cuz that feels like I'm saying, "Hey, that's an error." So, I don't really understand why. New error. These are those Typescript errors. This is the Typescript ism where I'm just like I don't even know what that means.
1:03:34On the big screen as my daughter wants sleep, right? Did you think you'd ever be on someone's Oh, yeah. I can TV.
1:03:42Don't even need those things, do I?
1:03:47Look how sexy that is. Huh?
1:03:58All right, let's go back to this thing. All right. Well, I'll have to figure out that I'll have to figure out why that's not showing me the uh I want to at least see this this message somewhere, right? I don't see it. I see the errors, but then the airs are empty. The airs is empty. The is the errors are empty. Oh, you can do a tag. You can do a little tag check.
1:04:40Uh tag equals failure.
1:04:54Tag cause. Is it cause run sync program? What? Whoopsies. Run sync program. Pro program. Okay. So, this is So, we're just going to go like this here. Let's get rid of that thing. Let's get rid of that thing. Let's call this thing program. All right. Let's reduce this thing down so we can kind of see what we're trying to do here. All right. Then we can just run the program itself.
1:05:32Oh, we can just go like that because it's just this thing. Okay. Well, I don't see that.
1:05:48Look at that beauty. Okay. Okay. So, we can see it all the way through. Okay, that's fine. I mean, I like that.
1:05:53I like seeing I like seeing that thing come through.
1:05:58What if I just erase that?
1:06:04Try is not assignable. Oh, yes. Of course, of course, of course, of course, of course, of course, of course, of course, of course, course.
1:06:20I want to see what the air is. Why are you hiding the air?
1:06:25Why you doing that?
1:06:29Just Just show it to me. See, I don't know how I don't know how to like look at the air. It's like so close. It's like right there. It's like right in my grasp to look at.
1:06:42Hey, Carp. How you doing? I hope you're doing well. Can't you put the error uh in your tagged error? You could because errors are unknown in TypeScript. I know that those are one of those phrase I'm I don't Looking like some good TypeScript there. Yeah, we're just trying to figure it out. You know what I mean? Sorry. This is a lot of lot of talk. I'm trying to stay focused.
1:07:06Yeah, it has some sort of a more depth. Go deeper.
1:08:08I don't think I nailed it. I don't think I nailed that one. Okay. Well, that's not what I wanted to see. Oh, you can do this thing. Is that real? Is this real? Can this actually happen? Is this Is that a real JavaScript? I've never played with the console. Okay, I'm just going to pretend like I don't know what that is for now. See, that's what I thought it would do. I just assumed that would happen.
1:08:42Best oneliner. Oh, console dur.
1:09:11Never heard of that.
1:09:13Dur directory. Yeah, I know. What? What?
1:09:17What is that? What does that even mean?
1:09:25Okay. See, I see people. So, Hold on. We got to We got to address a little bit of YouTube, guys. The purpose of learning how sus stuff works is that you can take your time to understand how to write stuff to make things happen quicker.
1:09:38Do you get that? And so, see, you're falling under what I call the false illusion of progress, which is you see things move forward, but you don't actually understand how they work. And so, you can only go forward as far as the thing in which can move forward. Which means you yourself ain't nothing but a little script kitty You don't want to be that. Okay?
1:10:07You want to be You want to be something You want to be something strong like songs with the funky break. Does that make sense?
1:10:15Yes. We have to def We have to literally defend learning today. you live like this. Yeah, you live like this. I don't want to be a meat proxy, right? I don't even think I think that word's a horrible word. This song is so based.
1:10:39Who doesn't love dragon born?
1:10:47All right, let's go back to reading. I Let's stop with these like I don't want to keep on doing like side questing. I'm just trying to go through all these things. With effects succeed and fail, you can explicitly handle success and failure cases when the type of the system will ensure that the errors are tracked and accounted for. Okay. Yep. Okay, we get this.
1:11:08Yep. This all seems very very All right, we went through this. This was great. All right, we already went through this. We already went through all this. Okay, fantastic. All right, we did we did try we did that. Nice. You can think of this as a similar pattern as a try catch. Yep. Modeling asynchronous effects. In traditional programming, we often use promises to handle asynchronous computations. However, dealing with errors in promises can be problematic.
1:11:37By default, promise value uh only provides the value type for the resolved value, which means that the errors are not reflected in the type system. This limits the expressiveness and makes it challenging to handle and track errors effectively. To overcome these limitations, effect introduces dedicated constructors for creating effects that represent both success and failure in the asynchronous context. Effect promise and effect try promise. These constructors allow you to explicitly handle success and failure in cases that leverage the type system to track errors. Now, do people understand why
1:12:19Let's just pretend. Okay. So, I'm just going to assume. Okay. I'm going to try something different. Hey, Niche. Dude, I hope you're doing well. I'm just going to pretend the rest of you guys besides for Night Shade are just uh systemically Okay, so you want to build an application.
1:12:37Do you want to be able to hand off to the model being of course, do you want to hand off to the model a bunch of promises or do you want to hand off things that can track errors as well?
1:12:53If it could attract, if it can track errors, wouldn't you naturally create more robust code?
1:13:02Yes. By the very nature of how this works. What do we think about R as a programming language? I don't think is a programming language, but thank you. Uh systemically, yes. Throughout your entire system, everything works against you.
1:13:21Uh why why why it's hard to track errors? Uh okay, hold on. I might be getting one-shotted, guys. Am I getting one guy? But here, I'm just gonna follow this for a second. Uh Leel, how much programming experience do you have?
1:13:36Just just be honest here. No, no, like I'm not going to make fun of you if you say I have very little.
1:13:43No one's going to make fun of you. Okay, so you have 20 what?
1:13:5020 programming units. Can you just help me right now? Just like 20 what years of pain. Okay. So, you must understand that asynchronous boundaries usually mean that they're making some sort of call off to the network to some sort of external service, right? You probably get that idea pretty quickly then.
1:14:26So, let's just go back to this really quickly.
1:14:30Looking at this code, which one of these are going to throw errors and what are their potential errors? If you put a try catch around this checkout, what state are you going to be in?
1:14:43Do you see why this is really annoying?
1:14:46Handling and talking through errors becomes excessively annoying when every single line can potentially throw many an error. I don't I don't have to think about errors. No users. True. All right. Well, let's just go back. Where's the one? Let's see. Okay, this one's really good. There's like Han Zimmer on a guitar.
1:15:33Yeah, let's do this one. This one's such a banger. Except for the Dune. Dune is kind of annoying. I do have to say Dune's kind of annoying. By the way, you'll notice Han Zimmer is somewhere in here and he just somewhere in here just comes out with a guitar then jumps on a piano. You would never have guessed he's Han Zimmer, the legendary creator. Instead, he's Hans.
1:16:03Oh, how we're doing here? Nice. All right, this is good. This is good. This is going to switch over here soon to uh Lunafast Low. All right. So, modeling synchronous blah blah blah asynchronous. Okay. I assume these are all the same thing. Resolve.
1:16:31Okay. This seems all easy. This I I mean I get all of this.
1:16:47Exact same. Okay. This is all the exact same stuff. Okay. Fantastic. All right. Sometimes you have to work with APIs that don't support async await or promises. Instead, you have to use a callback style. Yep. Yep. Yep. Yep. So, you can just do this one. Effect call back.
1:17:10Okay. Okay, fantastic. Very very simple. Okay, we we already kind of I guess understand this one. Let's see. Um there we go. In the above example, we manually annotate the types and calling effect call back because Typescript can infer the type parameters for a call back based on the return value inside the callback body. Annotating the types ensures that the values provided to resume uh match um the expected types.
1:17:38Fantastic. The resume function inside the effect call back should really be called once. Calling it more than once will result in extra calls being ignored.
1:17:51This line will be ignored. Okay. Okay. So there's no there's no resolve and reject in a call back. It's just a single call back. Yeah. Yeah. Yeah. Yeah. Han Zimmers and Jasper kid. I don't know that one.
1:18:11What you will do if I am Han Zimmer?
1:18:13Well, you're not Bruce. Bruce King advanced usage. Okay, let's see. Call back blah blah blah. Let's see. Example handling with interrupts and cleanup. Okay, let's look at this. File name data call back writable stream write data unfinished error resume effect fail on sync okay I see what's going on here okay so on a call back it does have the option for an effect that can be ran which can handle like any sort of
1:18:55resource cleaning up okay that makes sense program effect I still don't understand this part this whole generation business affect forkchild write file with cleanup this thing some long data sleep one interrupt fire this will take uh this will trigger uh the cleanup
1:19:35I don't quite understand this this con these concepts right now. Forkchild is fork child some some kind of that just means it's in some sort of it's like spawning a co- routine and killing it. Well, no because it's not a co- routine. You can't don't use words that cuz it's not it it can't execute. It's just right. It's not executing in parallel.
1:20:03So somewhere along in here this thing is executing and since these don't take the uh the event loop for very long they can kind of write I assume since there's no right write right just takes a long time it must be using it uses the uh the actual time on the event loop sparingly because most of the time is probably spent off in C++ land anyways is my assumption.
1:20:25Okay, so this I don't really know what this does. That's fine. I don't really know what this does. It's hard for me to understand when something is this like an asynchronous sleep.
1:20:39How does a sleep one work here? Because do you have to await?
1:20:43How does yield work? See, I I don't really know generators and yielding. And so that that's probably a big problem there.
1:20:52They're green threads.
1:20:57They're green threads. So they're actually separate. So they're actually separate. They actually run as a worker. Is that what you're saying? Fearless concurrency. Uh I can live with that. Child process management sucks in vanilla JS. This feels better. Uh no, they run in the same thread. I know what a I know what a green threat is. Okay. Fantastic. All right. Super duper.
1:21:45All right. I don't I still don't quite understand what this the forkings are doing, but let's just pretend I understand what that means. It will come later. I'm sure of it. All right. See if the operation you're wrapping supports interruption, the resume function can be received uh can receive an abort signal.
1:22:05Okay. Where's the bottom? We're going to run the program. The program does this forky thing again and it does the interrupting again. And then this thing has this call back and it has a signal.
1:22:18Which means that we're going to do a little set timeout. Simulate a long running task. Okay. Okay, it's going to do that after 2 seconds. Signal add event listener abort. Oh, do you use cardality or whatever they call that? What whatever the whatever the word is for multiple arguments in JavaScript. Not cardality. What's the term? Arity to determine what function you're calling. Hey Brian, feeling great. Yeah, feeling okay.
1:22:54So, you just have a second one. This is always an abort signal. Okay, that's kind of neat. And then you can just do an event listener. You do this one. You clear the timeout. Okay, that makes sense.
1:23:14Suspended effect. Take an effect and you return an effect. Let's explore some common scenarios where let's see will pro prove useful. Okay, we need defer the evaluation of the effect until it is required. This can be useful for optimizing the execution of effects when they are not always needed or when their computation is expensive. Also, when effect with the side effects or scoped captures are created, use effect suspend
1:23:39to re-execute on each invocation.
1:23:51Okay, this makes sense.
1:24:05Yep. Okay, that all makes sense. I understand how that gets. My head hasn't quite wrapped around the term suspend for this is used to delay the creation of an effect.
1:24:34It's an effect that makes an effect.
1:24:38Did I get that right?
1:24:42It's an effect that makes an effect. The whole descriptions of programs things is very confusing at first. I figured it would be there's like a little bit of time that I need to look at it. You've asked this question, Hiro, way too many times. Hiro, stop asking the question.
1:25:13If you're if you need to learn something, you go and learn something. I have a few minutes right now. Do you want to hop on a call and quickly answer any questions and then back to docs?
1:25:21I mean, my only real question is like, okay, I get all these things in in small amounts.
1:25:27I don't feel like I'm getting um I don't understand how that jump to this jump exists yet, right?
1:25:43Right. So, there's a lot of like steps that still have to happen to get to the next thing. And so, I don't really see currently I'm just looking if you haven't gotten to the requirements. Also, uh your AI generator looks scuffed. Well, this is just what uh this is what your file told me to generate. Okay.
1:26:06I wouldn't start from your generated version. That's I know that's why I'm trying to start from the other way. I've my my uh my lititness test of me understanding the generated stuff is I can look at it and understand it, you know, just like look with my eyeballs and go, "Okay, understand these things."
1:26:28Sure, TJ. You can jump on. Hold on one second. I got to get water. All right. Look at that guy. You want to be that guy? You can't be that guy. Also, let me just make sure that this is playing out of both things. I call TJ and then he's then he's immediately gone.
1:27:05All right, I'm going to go get a drink. TJ's going to be on any second and then he'll explain some things to me.
1:27:30Hello chat. Can you guys hear me?
1:27:33Hello. Hello. There we go. I believe you guys should be able to hear me. My voice coming through. Okay. All right, chat. So, quick question. I need ones in the chat if you want me to gaslight him and tell him completely wrong information for about 30 minutes and twos in the chat if I should tell the truth.
1:28:03Yep. Okay, that's that's a really tough call, honestly. That's a really tough call. 42. Wow, guys. Prime has to turn Prime has to change my volume. I don't I don't have that kind of power over the stream. Okay. I don't have that kind of power over the stream. Just shout. My kids are doing homechool in the room next to We can't do that.
1:28:34They'll get distracted. They'll be like, "What is crazy dad doing next to me?
1:28:40He's asserting dominance by lowering your He wants to be able to talk over me. He's scared of my effect knowledge."
1:28:50All right, hold on, TJ.
1:28:52Oh, nice. What's up?
1:28:54Chat says I'm really low.
1:29:07Stop singing. You're not Han Zimmer.
1:29:09Dude, you we've been listening to a lot of truck tunes later or lately. I mean, what's truck tunes?
1:29:16Sorry, I'm unfamiliar.
1:29:17Oh, it's a great kids song series where the guy has all videos of trucks actually doing stuff. So, you like you can listen to them. Then there's all like every kind of truck imaginable. Snow cats, airplane deicers, Diamond grinder machines. They got it all. Song for everything.
1:29:38He said he's gonna gaslight you for 30 minutes.
1:29:46No, that's not true. Uh, let me let me tell you the truth. Um, which is really funny after someone says that I'm going to gaslight you for 30 minutes.
1:29:55All right. Well, hey TJ, let's just get to the heart of the matter. That's I said chat, type one if you want me to gaslight him for 30 minutes. Type two if you want me to tell him the truth. And chat said ones. So that's kind of where we where we were.
1:30:11Okay. Well, let's not do that. All right.
1:30:13Let's not do that. Let's not do that.
1:30:15So, right now, so I'm just telling you where I'm at, which is Yep. I've been watching. So I generally get the the the the effect the the very simple very obvious usage of it. When you look at just this one, you know, this very individual one thing, it's hard to see why this is useful.
1:30:34I agree. I think Yeah, I did you get to um like using generators?
1:30:40I think that part's kind of nice. I don't know if you I haven't got there yet.
1:30:43That's a couple spaces away.
1:30:46Yep. Yeah. Yeah. That's okay. So I I I think so Mike I know Mike's in the chat right now. I would say you gotta which they know they're like we're rewriting everything blah blah blah. That's fine.
1:30:56They did just do a major you know they're doing a major version and all this other stuff. I would say like the the the coolest part you figured out for all of this in the first five minutes for the like first part of effect which is that hey guess what JavaScript doesn't track errors and that's really bad and it makes your life really hard.
1:31:15That's so cool. So there's like other libraries that also tackle that problem, right?
1:31:21And so you're like cool, why not use those uh over effect and like if that's all you were going to use with effect, but so far we haven't even used like the third um like thing of effect. So there's one is the return value, two is the errors. We have haven't even done the requirements thing. That's the other part where stuff gets like really um exciting. And that's what I was getting excited to see, which was I was hoping to jump into that a little bit quicker.
1:31:48Yeah. I think we should just go to the guides page. So, instead of uh onboarding, let's go to guides at the top here.
1:31:54Yeah. Yeah. Yeah. I'm there.
1:31:55And I think we can I think we can just we'll since you actually know how to code and read things, we can we can go through some of these a little bit, you know, faster than maybe uh Twitch chat with their, you know, skill issues and etc. So in the requirements management one that that one right there let's just go to this first services one. This is where it's cool. This is where immediately you'll be like ah this is very this is very powerful.
1:32:20Um which I can just walk you through like literally what the code says. Right. So if you look at like this first piece of code here, right? It's like hey you have data plus the service you're going to call to and do some sort of operation on.
1:32:31Right. And now you're like cool. I'd really like to be able to have like logging too. So then what do you do?
1:32:37You're like safe, bro.
1:32:39Grab bag time. Time to make a global object.
1:32:42False. You go in here and you have globals.ts and then you have set contacts.
1:32:51I am not wrong. I am not wrong on that one.
1:32:53That's actually the better way than passing around a context grab bag all the time.
1:32:58So, right. So, you immediately like have seen this before and it's really annoying. So then this like instead of having this extra value here um you have now this like third parameter of all effects right like which is this requirements yes so requirements is like most of the time you use it with something like a service I maybe there's some other thing I assume you use it it's like an effect that yields a value that required that
1:33:27value to do some sort of hoop jumping of some sort to get like like like like I assume it's like a Postgress connection where it's just like you have to first an example. Yes. Okay.
1:33:38Yeah. There's other things too like um so effect has which we probably won't like go over today but just like examples of cool things that it could be. There's like effect has a concept of like a scope where you like open and close a scope. So this would be something like you would use maybe like when you're doing tracing, right? So like the stuff that you were doing in Sentry where you're showing like each of the different things you're like starting something and stopping something. You could say that a particular effect requires that it is in a scope. It's like, hey, I have to be in a scope. So, you have to like start this
1:34:07up and then close it down later or something like that, right? And so then you can actually like name that scope and do all of this other stuff. And you can like handle uh resource acquisition and release, which of course like the release is always the it's easy to get resources and it's really hard to release them.
1:34:22Easy to malic, hard to free. Everybody knows this.
1:34:24Yes, exactly. It's the It's easy. We can malic in the loop. There's no problem. Never been a problem.
1:34:30A problem, actually. Um, everybody knows it. Chat should know this.
1:34:36Uh, by the way, YouTube is now starting to press one.
1:34:40They're finally there. They're finally catching up to us. They're finally Um, so if if you scroll down like a little bit farther on this page, it'll show an example of like a simple a simple service like a random service here, right? So basically right it's like you make just like how you made a new error type or a new value or other stuff like that you can also make new services right so effect provides things that you can extend and this says hey um
1:35:08what does this do it provides a next function which returns an effect that is a number that's the class object with whom extending is also passing in itself as the thing that's being extended yep that's a un that's a typescriptism that sucks but it's the only way to like make it like ref. I don't really remember why this one stupid.
1:35:28Yeah, when I saw that I was like random.
1:35:31that's where like uh Kit Lankton the creator of effect of course um tells you hey we have to put these in two spots so that it works and that's and and we wish we didn't but it's Typescript and you're like I believe you.
1:35:45Um so then that's like the interface that this service provides. It says, "Yo dog, I give you a next that, you know, I have a function that returns an effect for for next, right?" So, like it's an effect. Sorry.
1:35:59It has a field that is next, which is an effect for a number, right? So, you can now um if you scroll down like a little bit farther on this page, we'll you can come back and read a little bit of this. I just want to show you this part and then you can explore a little bit more. Random, right? So, it declares what the service is. So now here's where things are cool.
1:36:19Uh, and let me just walk you through what's going on here for yield, right?
1:36:24This is the thing that I think when you first looked at effect like four years ago or something, they didn't have this and you were like, "This really sucks. I have to write like a million lines of boilerplate for everything for this to work."
1:36:36Um, yield like fixes that. And you can pretty much just think of yield as like do the effect.
1:36:45Yes. So it's like do the effect right?
1:36:48So that's like a weight basically, right? If it's asyncing a weight, right?
1:36:51But it's also like right whatever.
1:36:54Yes, we now have red, blue, and green functions, right? Uh but except this one you only ever have just effect. So if it's synchronous or not synchronous, it doesn't matter. You always just yield.
1:37:05So you never have to do like, oh, that effect is an asynchronous one, so I have to do yield await something. Oh, I have to await the third thing in blah blah blah. Right? So these are just generators. just that's the way that it works. That's the best that you can do given TypeScript's um limitations, right? So, it's fine.
1:37:24Yeah, I probably I probably need to go spend like 30 minutes just playing with generators for a second because I don't understand the async portion of it, but I'm sure it makes sense at some point.
1:37:34Yeah. Yeah. So, that part is like you can go back to it, but I'm just showing this is the payoff for getting the yield. So, we can yield a service. That line on line 14 yields a service, right?
1:37:46So you get a value back that is that service that random thing is saying hey I have this service that ex that I want to get and I know that it has a thing called next that is an effect that gives me a number question so when I question this yield right here it yields particularly this thing right here so actually if you look at the type signature you'll see that the third value for the effect for program is what
1:38:14what's the like if If you look on line 11, it shows you Oh, line 11.
1:38:19Yep. Mhm. So, it says, "Hey, I depend on the random service." Basically, that's a requirement for me to be able to run.
1:38:28So, if you never give it random, it won't like it won't work.
1:38:33You know what I'm saying? Just say like I I can't it will it will have a type error and and not compile. Yeah.
1:38:38Okay. Yeah. Yeah. Let me let me see let me see this one.
1:38:42Yeah. Because I'm actually curious about that. Okay. So this one goes. But if I don't Yeah, you should be able to like hover program like you know with shift K or whatever and show that like hey that that says um it says it says void never never random.
1:38:59Okay. So how do I how do I take away its ability to have random?
1:39:04So if you it take it ability to have because it says run promise but then it says provide service and then it does this right? So providing service is saying basically hey I you need yeah right if you just tried to run program like you were doing before right where you had like right like this it'll say that doesn't work this thing yes because it's a void never never and it doesn't have and it doesn't have it obviously like
1:39:32this is cooler when this is like a database service and you have it hooked up with Drizzle and Drizzle has an effect provider and Drizzle says cool uh you said you were going give me a Postgress connection but you never actually initialized that yet like right that could be something where you have a startup sequence and your startup sequence tries to run migrations but you haven't actually connected to the database yet because the globals thing gets right you like you can't do that problem uh in this case right so
1:40:00provide service is a way to say hey this program needs something that implements random right and then this one this random just literally always returns 42 too.
1:40:11Okay. So, if we had a program that has I still don't really quite understand it. It has many subchildren effects and at the very very tippity top its requirements has several things that it needs.
1:40:25Then I make just make it make literally another one here like at the top make another service. It can just literally be called random too or something. It doesn't matter.
1:40:34Oh, nice. Even more random.
1:40:36Electric boo. Thank you.
1:40:39The tags. I think the tags might need to be the like string part. Just make sure that that says something else. Yep. I don't remember. There's like Typescriptisms for some of those things.
1:40:48Hold on, hold on, hold on, hold on.
1:40:50I think it's just saying you haven't used this.
1:40:52Yeah, don't worry. I I get that.
1:40:55We're going to switch to Omega for for Ben.
1:40:57Oo, nice. True. Great. Yeah. Thank you.
1:41:00Thank you. And so that means I could also I could also do uh OS for Omega and go Omegaar, right?
1:41:07Yep. Mhm. And so that means now this thing is like okay this thing is broken because right we have one we have random but it's not getting all of it right is that why do you have to do it twice?
1:41:19So it's going to show you this like slightly probably further down in this file that you can instead like create a service that you can keep all the time and you can provide it more often.
1:41:31It's it's going to get you there in a second like a simpler way to do it. Uh but you can basically do providing a service program.
1:41:39Yep. Uh so it and then you can do multiple of them and then eventually you're going to get to they're called layers which is just a way to like put multiple services together more or less, right? Um okay. So we're going to provide service.
1:41:52So this is when you can provide a singular service to one thing. So this is kind of like a one-dimensional call, right? And then later it's going to say cool like if you want us get the shape of this you can pull that out. Here's the multiple services that you're looking for.
1:42:06Yes. This is the thing. Okay. So we do a a pippity pipe and then we provide service random provide service logger.
1:42:14And then where does the program get tossed in here?
1:42:18Program is the first thing that's it's program.pipe. So like on line 31.
1:42:21Oh program.pipe. Oh my gosh. Yeah. Okay.
1:42:24You can pipe it to as many things as as you need, right? All right. So, this is where I do that thing.
1:42:30Or then I drop that bad boy.
1:42:35And then for in this case, since they have literally the same the same, you know, set of things, you can do that as fine. Uh but then, right, instead of it being provide random twice, you need to put I thought I did, but I must have. That's fine.
1:42:52Oh, beautiful. And then now it works, right?
1:42:55Okay. Um, right. So, so this is where like they start to compose together like much more interestingly, right? In the sense that like cool. Now, my if um Oh, a a cool thing that we could do instead here is like let's make omega star like um Oh, nice. Beautiful. Great.
1:43:15Let's make it so that it says omega can fail like on its in its effect instead of just number.
1:43:21Oh, yeah. We can also have HTTP error or something like that. Yeah, is fine.
1:43:27Can I provide the next function here or is this like one or the next thing here?
1:43:32There is a way that you can write them all in one but I forget the exact syntax for it. I don't remember if it's literally that or um it's it's it's in this page somewhere. I don't remember offhand.
1:43:44Okay. Yeah, I just I was curious because Yeah, it's Oh, it's it's the next page in the guide called default services where basically you can make something that like says I think um yeah oh no no sorry managing layers it's one of these they changed the syntax on me a touch if I recall uh from three to four so I forgot what it is and you know now my my agents write it for me so I don't remember the exact syntax but yes you can do it in yes they you can provide it in line
1:44:13basically and have it like in further reverse of it, right? So whatever your service like actually does then it will it will show those. Right.
1:44:22All right. So this thing just grabs a number.
1:44:25But it could fail.
1:44:26But so now look at your program. Yep. So look at your program type online.
1:44:32Yep. Right. So in general just as a note like I I think they also just as a note Mike and team I would never show an example of putting error there because that's never how you write it in practice like you would want to define like an HTTP error or something like that right or whatever and then you would use that as the kind of error that this service could do. never return raw errors because that like collapses everything because everything is um like error is
1:45:02the parent class of all the errors.
1:45:04So, you know, so it's like cool. Yeah. So, that's always true. Anytime there's a possible error, this one's always true. Well, that like defeats the whole purpose of effect as well. Like I know that promises can always throw an error. That's literally not the point.
1:45:17Um I want to know the type of error.
1:45:19You know, you did the like data.tagged error, whatever. There's also like some schema errors and some other things like that. there's some options for how you can define errors and they do really cool like you know cool stuff there but like that's uh that's how you do that right so now those just like compose together just fine one of the really interesting things is like let's say you have um like a user service or something right and like your user service in practice depends on Postgress right
1:45:48but if your user service is just like get user and it e and it returns a user or a not found Right? It's super easy now for the test if you want to put in a you don't have to like mock and put a bunch of fake data and do a trillion other things. You just literally write a function.
1:46:07My test this is empty user case and you provide one that that throws the not found error. Right? Okay.
1:46:14So then your services can depend on other services but you in general don't try and let those leak to the top level.
1:46:21Right. So like your production user service uses Postgress like your test user service could literally just return objects. You know what I'm saying?
1:46:30Does that make sense?
1:46:31I think so. I I want to play with it a little bit but I I have a general idea of what it's doing there.
1:46:36Right. So basically like the requirements only surface the ones that aren't uh like provided in that like block. Right. So in effect.gen Jen, if you like instantiated a random or something like that, you could close over it inside of the actual like program like 10 lines up or whatever on line 18 and then it wouldn't it wouldn't say that it depends on omega star.
1:47:01Yes, because I go I can go const random and go a new random.
1:47:07Yes, I don't remember exactly what the you have two things called random, but I think otherwise it will there's like I don't remember exactly how to do this. I never do it this way because you want to have there's like an effect there's a way to do you need to do it with effects to like properly create it in line regardless. Uh you know what I'm saying?
1:47:29You can do that and then it wouldn't depend on random anymore like that would drop from the random, right? So if you create your Postgress connection where you create your user service like inside of the block and you return that then it wouldn't externally depend on Postgress right you know what I'm saying like it it so you can make the outer service type not have to say that so that's what like this is where stuff starts to get um like quite interesting for me this is
1:47:58why I like it a lot is it lets me like write the boundary of a service right and then I can test it like a lot more confidently like in individual blocks.
1:48:08And then I don't have to worry that the AI is going to like reach inside and like run random SQL queries against like Postgress. It doesn't have access to the po it I can literally look at the type and I know it doesn't open a connection to Postgress. You know what I'm saying?
1:48:22It doesn't it doesn't go like oh cool I'm in the for loop here. I'm going to open and close the SQL light or the Postgress pool 85 times. You're like no no no no dog. You're not allowed to do that. You can't just run run that here or something like that. Um, so there's there's some other things that are cool like I think that um I'm trying to think like that would be easy to show off. I mean the other one that I know you would like a lot are is schemas.
1:48:48Um but when I looked at this documentation last time is uh I was not super impressed. sorry effect team who are in the audience that it takes forever to figure out how to actually use them. Um, but you could probably do I'll paste this one at least. I think this one's okay.
1:49:11Um, in in chat I think this is the other one where it starts to get really nice because like people write TypeScript in a way where they say JSON.parse as my cool strruct.
1:49:25Yes. or they just return the raw thing and then because it's an actually it's an it's a any that comes out of there it just gets automatically cast and all that fun stuff.
1:49:33So this is like hey uh you kind of want to actually know that the thing that you're interacting with is actually the type that you say that it's going to be.
1:49:45And then of course like each of these things by themselves of course is not maybe the most like wow that's mindblowingly crazily different than anything we've possibly done. I mean I think the dependency like injection thing is like really elegant. I don't see anyone else doing something as interesting as that in like Typescript. But most of the other ones you're kind of like cool I already have a library that does this.
1:50:09But then the cool thing is like these things all compose super nicely together. So then like schemas are how I define like literally every data type. I tell the clankers, you're literally not allowed to write interface. Like it's illegal for you to write interface in this codebase. You only define schemas.
1:50:26You never ever trust that the data is just what it says it is. We like actually have to parse it and make it make it work. Um then it gets really interesting when you combine that with like HTTP API which I don't even know if they have. Michael, do you guys have anam? Not you.
1:50:41Tier 100 tier 100. love this new TJ. Do you guys even have an example of that?
1:50:46It's kind of slow in the voice.
1:50:50That's where it starts getting for me.
1:50:52Like I just love writing um writing that stuff, but I don't know if they have any good like simple examples because you could totally write something here where you're starting from like a simple HTTP HTTP API um where or like making a simple to Oh yeah, go ahead. You you you I lost you there for a second, but yes, I I do I do want to get to that point, which is just like Okay, I think you would have a Yeah.
1:51:18What is Let's just like I want a simple server, right? Let's let's look at it from I think that's where you would have more fun.
1:51:25Yes. I think like you need to start from like cool. I have a little server and I want to do something in the browser.
1:51:32What's like a very simple um like Vit setup that does this. So, all I have to do is do bun rundev and then Yes, I know. I'm just going to have to set that up back and forth because again, in and you know, remember when you told me to use uh effect? I now have all this fun stuff which I have.
1:51:50Oh, that looks good.
1:51:51Everything def. Yeah, I know. Everything is defined as just a shared endpoint all the way through through and through. I did verify some of these things actually happened.
1:51:58I don't know what they mean, but I'm like, that looks nice.
1:52:00I know that the things happening that I think is happening, but that's it.
1:52:03And so, I have them all shared. I just love to put these as separate variables, which is annoying. You don't need to do that, but that's fine.
1:52:09Yeah, but then you get to do that. Have you thought about that? Like look at look at how cool that looks.
1:52:14That part is actually like ridiculously nice. The other I'll say the other thing that's super cool about this that I didn't uh chat says that looks nice, lau. Hey guys, have you ever thought about actually caring about the error cases?
1:52:30Yes, this does make me happy because I see this I'm like, oh yes, forbidden. Yes. This means this must be a uh what's it called? This is a authorized endpoint because I don't want people just sending me data.
1:52:40Right. Yes. Right. Those are actually like really important that you can enumerate all of those uh enumerate enumerate those actually. Well, um the the cool thing for this love that I called everything a wire by the way. Exchange failed wire session wire. I don't know what a wire is, but I'm very excited about it.
1:52:58That's that's the LLM loving one word and then getting really stuck on that. just um internal wire. I don't know what's going on there, but I'm very excited about it.
1:53:10The if if you're using this to hit an external endpoint that you don't know, you can write that HTTP API like as a as a specification and derive a fetch client from it. And it's awesome because then like you serialize and des serialize everything into proper schemas and then if you get some like unexpected field or a field isn't the type that you want it request. Yeah.
1:53:34Yeah. Yeah. Exactly. So, so anyways, I I think like if I think you have enough of like a gist of some of the things that I would say you probably want to just like and you can probably vibe like the hey, can you make me the most minimalist of bun run HTTP API servers that just does like health or something like that and start from there and then you would probably have like more fun playing there instead of walking through uh the guide is my guess and just like hovering over types like the type inference is
1:54:04the other thing is really good. Um, that I think would probably have more fun.
1:54:11As any as never. I'll prime I will I will I we won't forgive you for this. For real. I just wanted to see if it works.
1:54:17For real. For real.
1:54:19Um, for real. For real. Yeah. Yeah. In Yes.
1:54:22It's so funny. It's so funny. It is funny to be like we're doing the effect talk. Also, in the middle of it, we have as any as unknown as never. Like um So anyways, that's that's where I would say like you would have more fun is like cool, let's do a stupid to-do list app that's like hitting uh you know bun or hitting like a local SQLite drizzle thing, you know what I mean? And just like try and get that going. You could build the CLY first and like expose the end points and then just
1:54:51say cool now that I can run in a separate thing bun uh you know add to-do blah blah blah bun complete 7 bun complete 31 or whatever, right? And like do it from a CLY. Then you could be like cool, let's extend that to now like I'm going to put it on the front end. I can use one of effects like integrations with like solidjs or something like that. There's like some really good write this all in effect but use solid kind of things or whatever like whatever one you'd like to use there. You could
1:55:19play with that and like expand from there. I think you get the main premise of a bunch of these things and also as it happens you'll be like yeah of course it is nice to catch all the errors. But I love listening to you try and convince uh convince chat that catching errors is useful. I'm like guys, yes, that's the that's the that's the least controversial part of effect. Even if it's like I know I I I have completely confused by chat being like, "Yeah, but why would
1:55:48why do we care about errors?" Just like, well, I it's okay if you think, "Wow, that's really verbose to write the errors down or something like that." That's fair. Come on. Certainly, certainly we agree knowing what errors can happen is useful. That's where that's why I was like, am I getting one guide at the end? Because I was just like, I swear I'm getting I'm getting debated out here. Like, someone's messing with me.
1:56:10Yeah. Yeah. Yeah. So, anyways, I would I would try there and then see see where you can get on on that front.
1:56:15Okay. All right. I'm going have to do I'm I'm definitely going to have to do that.
1:56:19You read errors, dude. I don't even read errors. I make errors. But unfortunately, I do have to go as well because my throat hurts too much. So, okay. Oh, okay. We'll do this another day then.
1:56:28I have to I can only stream for short periods of time or else it just hurts too much. So, sorry chat. We'll have to continue on. I have very good intro into this so I'm very happy but throat hurts. So, I can't keep going. I know. Sorry. You know, it's been like what, two and a half years, two years since getting this weird throat injury, and it's just like, dude, I can't talk for more than like two hours or else it just it's just like hurts,
1:57:00Sucks, but this big old butt. I know. I know. I can't believe you guys have stuck around for this long. I mean, there's this many people watching at this time in the afternoon, which is unusual. I'm shocked by that honestly.
1:57:16You know, change the frequency. No, I don't like I don't like doing ASMR stuff. Is it because your Adam's apple is massive?
1:57:23Dude, my I have such a big Adam's apple. I don't know. I just probably too much testosterone, honestly. Probably too much testosterone. All right, so we'll do another stream this week and we'll continue on. I just like your mullet. Well, thank you.
1:57:43Uh, and we'll we'll do another one. And so, yeah, it's a very very effect is cool. The stream was it's a barely a showcase, right? It just shows like the basics, but it doesn't really quite show you what it's useful for, right?
1:57:59And so, next stream we'll do more and we will figure out how to um go to the next level, right? which is I'll try to set some stuff up for a server, play around with it, and then I can start going, "Okay, let's do let's do it." Okay, that's the international sign for let's do it if you get if you if you understand me.