#116 Infrastructure as Effects with Sam Goodwin - Episode Artwork
Technology

#116 Infrastructure as Effects with Sam Goodwin

In episode #116 of Happy Path Programming, hosts Bruce Echel and James Ward welcome Sam Goodwin to discuss the evolution of infrastructure as code and the potential of using effects to simplify and en...

#116 Infrastructure as Effects with Sam Goodwin
#116 Infrastructure as Effects with Sam Goodwin
Technology • 0:00 / 0:00

Interactive Transcript

spk_0 Welcome to Happy Path programming. I'm Bruce Echel. I'm James Ward.
spk_0 All right welcome to you Happy Path programming. It's been a little while.
spk_0 Yes I've been in the road September 19th 2025. Yeah you've been on the road a lot.
spk_0 Yeah we've had all kinds of things going on. So we had a few people come up to
spk_0 that was going to be the summer tech forum on conference but turned out to just
spk_0 be some delightful time with our friends Bill and they build Bill of
spk_0 Anderson, Diane Marsh. We haven't seen up here in quite a while and it was great.
spk_0 We must leave. Bicycle then heiked and hung out to restaurants and we hardly
spk_0 talked about programming at all. But you did meet with the Western University
spk_0 A panel. We did a panel where each of us gave a five minute presentation. The
spk_0 panel was called adapting to disruptive technologies or something like that
spk_0 which mostly was AI because the students are concerned about whether they've
spk_0 made a huge mistake in choosing computer sciences their job and we kind of
spk_0 said yeah we've seen this before. Yeah and everybody's got all of it AI is
spk_0 different you know and it's like yeah it needs to be hard problems to solve
spk_0 the requires humans and in fact lots and lots of hard problems haven't been
spk_0 able to be solved because they cost too much and AI allows us to solve those
spk_0 problems. Okay but you got the students excited to stay and yeah and they
spk_0 asked lots of questions and everything so it was very satisfying for all of us.
spk_0 And the other thing is we did nail down because we have a group of students
spk_0 coming from Western for the conference we did nail down the Winter Tech Forum
spk_0 will be the first week of March I don't remember the exact dates but that's
spk_0 probably on the website. Well I will be on the website soon. So anyway start
spk_0 planning for that if you're hoping to come this year. Yeah. All right great
spk_0 okay so today we have with us Sam Goodwin. Goodwin right? Goodwin. Yeah you got it.
spk_0 Yeah sorry with Sam and my connection with him was this was maybe a month or
spk_0 so ago I reached out to our friends at the effect company and the people doing
spk_0 type script effect and I was like hey I think that there's some potentially
spk_0 really interesting things we could do to revolutionize infrastructure as code
spk_0 in related to effect and they're like oh Sam just check out Sam he's already
spk_0 like building this and creating a whole new foundation to fix all the
spk_0 problems with infrastructure as code and so then I was like oh my god Sam yeah he
spk_0 is like and this is amazing so we got to have him him on and I reached out and
spk_0 then in one of our Twitter threads Michael and Arty are not all the from
spk_0 effect said you should have Sam on the podcast and yeah so here we are so Sam
spk_0 good to have you maybe where I want to start is infrastructure as code was
spk_0 probably like a good step forward from where we were before that which was you
spk_0 know certainly worse but I've always been kind of disappointed that a lot of the
spk_0 things that I have as an application developer when it comes to you writing
spk_0 code like debug ability testability I don't know rational flow and things I
spk_0 don't have those in the infrastructure as code world and and I always like
spk_0 left me like longing for for it to be more like code and so so I don't know
spk_0 what's your take on like like the state of infrastructure is code well the way
spk_0 that I think about infrastructure code or now it's just like a leaning tower of
spk_0 piece sort of how I think about it it's just so many layers on top of layers right
spk_0 so I'd like to point at the example of sort of the highest level infrastructure
spk_0 code experience before alchemy was ss t right and ss t dot
spk_0 dev so it's like a type script framework for deploying AWS apps is what it is
spk_0 but it's built on top of poloomy which is an infrastructure as code tool which
spk_0 is actually generated from terraform which is the real infrastructure as code tool
spk_0 which is a bunch of code written in go and it's a huge ecosystem so you're up
spk_0 here working in type scripts and you have to understand all these interesting
spk_0 layers all the way to the bottom and at the end of the day it's really just
spk_0 calling a few APIs for you right like calls the APIs in the right order that's
spk_0 what it's doing it is like why can't I just do that myself right like I understand
spk_0 that we we needed to solve that problem cloud formation terraform they came
spk_0 along and they said look yes calling APIs yourself and managing the state is
spk_0 chaos what we need is a more declarative system that's a good idea right but
spk_0 having to do everything through these layers like cloud formation or terraform
spk_0 that's just led to this complexity explosion and every time I want a
spk_0 distraction on top of abstraction where underneath the covers it's like state
spk_0 management and calling APIs right yeah I want to say it's just when I was when I was
spk_0 pitching it back in March I would say just to call fetch that's all it does
spk_0 it's called fetch in the right order that's all it does and if you put it in
spk_0 those terms you realize oh wait this is actually pretty simple and another thing
spk_0 I'd say is there's it's very broad but most people just need a very small
spk_0 subset of that breadth right like how many people use every AWS service or the
spk_0 thousand Azure services no they got like a Lambda function a table in a database
spk_0 right there's there's a nice subset here that if you can nail down with what I
spk_0 like is like a hand can't like a handwritten experience I think it ends up with
spk_0 being a lot better so like how can we kind of started out of I tried
spk_0 everything and I've always been obsessed with building a new abstraction on top
spk_0 like adding another layer on top and every time I would just get stuck with
spk_0 oh it's in the some go code or no it tries to serialize it it does like so many
spk_0 different hacks that it does and I just want a bug ability is like you would have
spk_0 to know where the problem was occurring in all these layers yeah and you can't
spk_0 change any of it like you get well what you want to you want to change in a
spk_0 terraform so submit an issue wait three months then it gets merged wait more
spk_0 time for it to end up in poloomy it gets merged wait for sst to update their
spk_0 version of blue you know like it gets crazy right whereas those abstractions
spk_0 generally don't give you the escape hatches that you may need like like unravel
spk_0 the thing and then inject some other thing in and yeah and it's just because
spk_0 we built all these abstractions on top of abstractions becomes really hard to
spk_0 untangle which is expedient for experimentation and trying to figure out oh
spk_0 what should this thing look like but maybe not for actual use it's just another
spk_0 example I think of where infrastructure is code isn't generally giving me the
spk_0 benefits of being in code I don't think anybody's treated it as a first class
spk_0 problem like first class computer science problem but I think that's what
spk_0 you're trying to do right well yeah the thing to observe that infrastructure is
spk_0 code is it's declarative at the end of the day like it or it works best when
spk_0 it's declarative I kind of deviated from that with the first version of
spk_0 alchemy I was like get out of my way give me async functions because every
spk_0 infrastructure's code tool has some wonky graph abstraction in order to be
spk_0 utter declare your infrastructure analyze it look at a plan make a change those
spk_0 kinds of things you need this graph abstraction and with that you always end up
spk_0 with losing power now you're not actually in code anymore right now you're in
spk_0 their abstraction and that becomes limiting so I threw all that away and I was
spk_0 like look it looks more like a durable workflow like a durable workflow is like a
spk_0 memorized a bunch of function calls so if you've already created the table
spk_0 just skip it and give me the props or if the properties have changed update it
spk_0 you know so you can just run that as a memorized function so that's what alchemy
spk_0 started us right as like async await it's just a script you can await
spk_0 promised at all you can loop over these things you can build nested stuff and
spk_0 like that power as that's proven to be and you can just call like the base APIs
spk_0 on your infrastructure provider if you need to I was experimenting with that
spk_0 alchemy I'm like okay this thing doesn't exist in in alchemy at the time but I
spk_0 know there's an API to do this on AWS and yeah normally in most of the I
spk_0 see platforms that I've used that means like oh the escape hatches pretty gross
spk_0 when you need to take it for how you actually just end up calling fat right to
spk_0 that it's always it's always gross man like so like let's look at that
spk_0 terraform well I've never gone down to that layer that just seems like insane to me
spk_0 I don't even like build up create a package publish it make it so it integrates
spk_0 into terraform that's complex cdk you go to define a lambda function so like I
spk_0 have to deploy infrastructure so I can implement my own infrastructure you know
spk_0 like it's backwards and that's very complicated right and then if you mess up
spk_0 you're waiting like two hours or if you forget to misconfigure so you go out
spk_0 and get a coffee and you don't make any progress right or if you go with it's
spk_0 yeah or if you go to another place where I see for me just totally fails is on
spk_0 the iteration loop like you're saying it's like oh my god why do I have to wait
spk_0 hours just to get the air message yeah I know and why don't why can I control
spk_0 C and kill it you know and just stop it when did you kind of come across the
spk_0 idea of using effects for for to solve this problem yeah well effect is my new
spk_0 thing because maybe like I've been watching it for a while but maybe like a
spk_0 month or two ago it clicked that it solved this age-old problem that I've
spk_0 been thinking about since probably 2019 I built a thing called punch card which
spk_0 was again the same idea of merging infrastructure and runtime code and the
spk_0 cool thing that it had was inferred I am policies but they weren't really
spk_0 inferred they were like hacked together it wasn't very principled right but
spk_0 they I moved on from that I was like no this is a compiler problem what I need
spk_0 to do is I need to statically analyze the code and see what resources you're
spk_0 interacting with because the resources you're you know I call get item on a
spk_0 table well I need get item permission to that table or if I write put item or
spk_0 put by put object I need those permissions right so you can infer it from the
spk_0 code so I have built a lot of hacky compiler hacks on how you get to like a
spk_0 compiler plug-in to be able to do that analysis to to then and then the other
spk_0 problem is I so I inferred I am policies that was actually easier than the next
spk_0 problem which is closure serialization which is like how do you extract the
spk_0 code that needs to go into the lambda function and and drop all the
spk_0 infrastructure code because that's heavy right infrastructure code might
spk_0 blow your bundle up by like 50 megabytes you need like 20 kilobytes script and
spk_0 you've got 50 megabytes your cold starts so didn't so I always thought about it
spk_0 through that way and I've been thinking about that for a while and then when I saw
spk_0 effect I'm like oh requirement channel the requirement channel like it's an
spk_0 I am policy is effectively a side effect it's kind of what it is it's a static
spk_0 side effect you can model it extracted out of the type so when I started playing
spk_0 with effect maybe a month or so ago and I was learned about context and
spk_0 requirements so it was like oh boom inferred I am policies we we can do it this
spk_0 way and then I was like okay great and this can also solve the other problem in
spk_0 alchemy of making it more declarative so effect is pure right alchemy right now
spk_0 is just a bunch of async functions those are eager they just evaluate instantly
spk_0 so you cannot do any planning and planning depending on who you are planning is
spk_0 a is a show stopper right so I was like okay what just all of the experience
spk_0 side you can when you have something that can create a plan for you then you
spk_0 can review the plan before you actually deploy it which would yeah allows me
spk_0 to then have a much better tight in it iteration loop before I actually go to
spk_0 the longer one of actually mutating infrastructure yeah and especially for
spk_0 like you know really annoying things like you forgot an I am policy right like
spk_0 with the new the new alchemy effect that talk about feedback loop it's
spk_0 instant like the compiler will just complain and say hey you're missing this
spk_0 policy and you have to add it right and I actually like the process of adding it
spk_0 explicitly like I've gone back and forth on this so it should all be inferred
spk_0 and you can look back at different attempts of this like there are programming
spk_0 languages for it they always end up having to build some way of confirming
spk_0 that's what you wanted well an explicit adding of the policy that's
spk_0 type check is a really nice way to do that yeah so you can just sit there
spk_0 write your code until it compiles now you know your I am policies are correct
spk_0 you know your environment variables correct and you almost know your logic's
spk_0 correct because the whole things type check by effect and then you can run it
spk_0 locally cool yeah then finally deploy right like I think they call this concept
spk_0 shift left it's a marketing term but I like to say there's no further left than
spk_0 the compiler right that is as far as you can go in terms of like guarantee
spk_0 correctness of your application the only thing that's a little bit further
spk_0 left is your IDE giving you red squiggly's which is essentially still
spk_0 generally running the compiler at least some some understanding of type check
spk_0 aim but yeah I think that's you're right it's like like you want to know as soon as
spk_0 possible that something is wrong with your types and then you maybe want to
spk_0 run it or test it or whatever locally and yeah so you've got this kind of
spk_0 layers that you want to expand out to with production being you know the
spk_0 furthest out but are you using the wait is it layers in zero yeah in effect
spk_0 and effect also calls it layers so yeah it seems like that would be a
spk_0 particularly useful thing for what you're trying to do well layers are perfect
spk_0 because remember that problem of closure serialization which is a nasty
spk_0 problem that you should not do in charge script it completely eliminates that
spk_0 problem so I can write all the code in reference to some big heavy provider
spk_0 that's going to be provided through a layer later but I'll only provide that to
spk_0 the infrastructure portion to the handler I'll just provide the clients so
spk_0 there's no more need for closure serialization you get an optimally tree
spk_0 shaken runtime handler with and you can it can have the types of the
spk_0 infrastructure but doesn't have the bundle impact of the infrastructure so it
spk_0 solves that in a more principled principled way versus trying to shoe
spk_0 home closure serialization into a language that doesn't support it and then
spk_0 because it's built on layers presumably you could even write like tests around
spk_0 your infrastructure and provide different like test layers and and validate
spk_0 you know your infrastructure which is another problem I have with traditional I
spk_0 see is there's no way to like unit test your I see code yeah and you know like
spk_0 there's tools like local stack which I find really complicated I'd much
spk_0 rather just provide a layer in there like like there's the prod deploy layer
spk_0 and there's the dev mode layer just provide the dev mode layer and that'll just
spk_0 emulate everything locally right so lots of things you can do with layers
spk_0 cool so me real quick stepping back to alchemy just give us the the pitch on
spk_0 alchemy where you know what it is where it started and where it's at now and
spk_0 then let me can jump back to the effect pieces yeah okay where it is now so
spk_0 it's currently in I call it infrastructure is touch script and it's very
spk_0 heavily focused on cloudflare right now so there was a big hole in the market
spk_0 for infrastructures code plus cloudflare no one had done that well primarily
spk_0 because their API is just terrible like they do not have the API culture of
spk_0 Amazon and so people would generate things with tariff form and
spk_0 SST was trying to do stuff but it's very limiting but I just jump straight in
spk_0 and just raw implemented it with fetch just figure out all the APIs there's a
spk_0 lot of hidden APIs so just implemented that in pure type script where every
spk_0 resource is just an async function that's all it is so if you want to add a new
spk_0 resource just add an async function implement the life cycle and then you can
spk_0 just integrate it into your application it supports deploying it supports
spk_0 live watch deploying so one cool thing is because it's pure type script you can
spk_0 just run bum dash dash watch and it will automatically do the same thing of
spk_0 every time you change your infrastructure redeploy and because it's in pure
spk_0 type script it's super fast that's probably my favorite thing about alchemy you
spk_0 don't have to wait 30 seconds just go back redeploy and we also have a dev mode
spk_0 which runs locally in what's called many flare so many flare is like a locally
spk_0 implemented copy of cloud flare so you get a really tight feedback loop and it
spk_0 supports all the main web frameworks integrated together into a single sort of
spk_0 application the final thing it does is unlike effects it goes the other way you
spk_0 write your infrastructure and then we infer what are called bindings that you
spk_0 can use at your runtime so that's a type that represents the table you want to
spk_0 interact with the database you need to call the bucket you can put so you get
spk_0 you still get that nice type safety but it goes from infrastructure to runtime
spk_0 effects goes from runtime to infrastructure so it's the other way around so
spk_0 yeah it's a really lightweight type script framework heavily focused on cloud
spk_0 flare with support for some other things like stripe planet scale neon things
spk_0 like that yeah yeah there's some AWS stuff it's not it's definitely not
spk_0 so good enough on AWS we integrated with the control API which is effectively
spk_0 cloud formation over API it's very slow it's imperfect we've got some hand
spk_0 written resources and I'm also working on my own effect client for the AWS SDK
spk_0 where I have ideas to generate resources that are guaranteed to be
spk_0 correct through static checking of the effect flow for the resources so that's
spk_0 sort of where I'm going there so you you started with alchemy is infrastructure as
spk_0 type script and much better developer experience and you can use it bundling the
spk_0 infrastructure as code and your actual application code and you get some
spk_0 benefits and it was at the bindings that you mentioned or yeah it's a type only
spk_0 link right so like you don't you don't have to you don't import the infrastructure
spk_0 into your runtime you just import the types so you can say the type of this
spk_0 workers environment and then you use that in the worker and that's basically all
spk_0 the you don't have to withstand shade clients in a cloud flare you just get a
spk_0 thing called bindings you go ENV dot and then they're all there and you can
spk_0 interact with them so that's a nice little experience but it's suboptimal
spk_0 compared to effect because it goes the wrong way round so if you don't use a
spk_0 binding you'll still have it there and with effects I can guarantee minimal
spk_0 like it's exactly what you need no more no less which I think is important
spk_0 so alchemy is out there and people are using it and it's good developer experience
spk_0 and much better than what we have in infrastructure is code elsewhere but then
spk_0 let's move on to the effect part where where I started interacting with you
spk_0 around the ideas of doing some of the stuff with with effects and we called it
spk_0 infrastructure as effects yeah I think you coined that term that's a good term
spk_0 I'm taking that man that's that's a good one I like it I A E it's so good yeah yeah yeah yeah so
spk_0 you with alchemy in effect so there's the core alchemy module but then there's the
spk_0 alchemy like a more effect during a module or something like that how's that work yeah good question
spk_0 right now the focus on is our proof of concepts of that like does it work taking
spk_0 some lessons of things that went wrong in the core of alchemy like this is a different way
spk_0 like rewrite of alchemy really like centric to effects or it it is right now so it's it's very
spk_0 focused on AWS and it is a total rewrite at the moment I do think there's a story to integrate
spk_0 like I don't want to we're not going to throw it all the way I also need to test this concept like
spk_0 effect is also you know a subset of the JavaScript community right so there's there's certain risks
spk_0 that come with that but right now it's yeah it's a total rewrite of what if I reimagined infrastructure
spk_0 as a code again from the perspective of effects like drop all the async stuff and just go straight
spk_0 for pure effect that that's sort of what that is and I will be able to build integrations and share
spk_0 code but right now it's not that important to share code because I'm focusing on AWS primarily because
spk_0 this flagship feature of inferred iam policies is much more relevant to AWS than cloudflip
spk_0 so that's that's why that is that way yeah but yeah go ahead let me ask okay I know you've only been
spk_0 exposed to this for a relatively short time but it seems like you picked it up pretty fast and I
spk_0 asked this question a lot because I'm trying to figure out how to explain it to people what how would
spk_0 you describe effect and effects not affect the library but the concept of what is an effect and what
spk_0 first of all I'd like to say I just figure things out I definitely don't read the books so I hope I
spk_0 don't give a terrible definition there's like plenty of them out there so you're not gonna hurt you
spk_0 not gonna hurt you and there's some background we wrote our book affecting our programming and
spk_0 shipped it last fall and it was based on scala because that's what our other co-author Bill and I
spk_0 knew best and we used the the zeob effect system but we're working on a type script effect version
spk_0 of the book and one of the things I was wrestling with is how do we explain what effects are and
spk_0 why they're helpful yeah that's where we ask everyone like like how would you explain this and hopefully
spk_0 that will help us get to a good opener chapter yeah well it's it's maybe one way of explaining is it
spk_0 it brings all of the actual side effects of your program into the type system that's the most
spk_0 important thing that I I notice about effects right so like this when you write a program there's
spk_0 always this side channel of like what's actually happening right what's actually being affected in the
spk_0 world by your program and as a developer you're keeping that in your head intuitively but it's not
spk_0 there in the program the program doesn't actually know that but effect moves that into the static
spk_0 type system so that and you can talk about errors but I feel like that general concept of like
spk_0 moving the all the things your program does are known by the compiler um I don't know that's a good
spk_0 definition but it's it's definitely what it's a good piece I think yeah and then and then for you
spk_0 they're with the alchemy effect there's probably some benefits around the the like graph piece of
spk_0 that like the ability to like establish a graph of dependencies and I would say that it's like so it's
spk_0 another thing yeah it's like rappers I like Marco Analty I think said this like representing your
spk_0 whole program as data structures right uh so each effect is just a data structure it carries logic
spk_0 dependent like context dependencies it returns some value and it has some error right um so
spk_0 people like that fit well with infrastructure it's good right it's declared it's declarative right
spk_0 here you go I've given it like in my hand is a computation here you go no no it's not a running
spk_0 computation I've been given it's not doing anything right now it's just a little packet with a
spk_0 computation and you can go do what you want with that you can move it over here you can run it run
spk_0 it again like so it's it's like we got to pass around a computation in a purely declarative way
spk_0 and yeah that's uh what is a cloud application at the end of the day it's a computation that runs in
spk_0 some context which is an infrastructure context it has some flow and it returns some value or some
spk_0 error right so it represents to me the most exciting part is the context followed by the error
spk_0 modeling type-safe errors so important especially for AI uh but context is the unblocker like
spk_0 I'm running in AWS with these dependencies beautiful that's what we needed yeah
spk_0 and then you in the world of IAC then you can you can look at that in your IAC tool and be like oh
spk_0 we can create the right I am rules and then you go as far as actually being able to infer like okay I
spk_0 need uh this effect takes an s3 client or whatever as a dependency that must mean that I'm going to
spk_0 need to create a bucket or is it is there still some kind of some manual you know thing you have to
spk_0 put in there to be like here's the bucket I want you to create or how does that work yeah so uh
spk_0 there's a so you call you declare a clause maybe I should share my you want to try sharing
spk_0 the screen here with the help book yeah we can try it uh it doesn't work you know for those just
spk_0 listening we'll try to explain what's happening but but we now have the ability to share screens
spk_0 this will be on YouTube so right people can watch oh yeah it needs to be much bigger yeah I'll zoom in one
spk_0 second uh you tell me when it's enough how about uh I'll get rid of that if I get rid of the sidebar yeah
spk_0 make it a little bigger please let it all bigger yeah all right is that okay yep I think that looks
spk_0 okay so that's some effect code we see some things that that well I guess tags but those aren't
spk_0 the the effect tags these are different tags yeah so these these tags so you define a you say I
spk_0 have a resource right so my my application has a lambda function right and it's got a name so you
spk_0 can define this and now you can refer to this anywhere that you want to you know for example call
spk_0 this function but refer to a lambda function you mean AWS lambda yeah so these model the resources
spk_0 specifically so like you know there is an idea we could get to which would be you know cloud
spk_0 agnostic modeling uh unless bullish on that because you actually want the uniqueness of the cloud
spk_0 rather than a general cloud but you know we could do an effect platform uh cloud platform there's
spk_0 definitely an idea there that could be pursued uh but yeah so then you define your business logic
spk_0 so like I like to think of a cloud application has what it has resource declaration so these are
spk_0 the resources that are part of my application then there's business logic independent or business
spk_0 logic defined in context of those resources so you can see an example here is I'm calling q.send
spk_0 right so I have another resource called messages which is an sqsq it's a five-foot q so you
spk_0 specify what type and you also can specify the schema of the the data that's inside uh that that
spk_0 q right and then I can just call q.send and you'll notice that there's a beautiful symmetry between
spk_0 that and the i m policy right so q.send is effectively sqs call and send policy that's what you
spk_0 need send a message so I infer that at the type level we know of this you can see that in the types
spk_0 in the context we depend on q.send message for that specific q the message is q so we bring that
spk_0 requirement of a policy to the context and then later on you explicitly provide it right so you
spk_0 hear when I actually make the lander function so that's the infrastructure so this business logic
spk_0 the runtime handler this is actually what's going to be bundled and put in lander and then there's
spk_0 the infrastructure this is the thing that will run to deploy it create it update it delete it whatever
spk_0 yeah right so these are like your pieces that you have in a cloud application and you still
spk_0 explicitly provide it because I like the opt-in nature so you can see that if I uncomment this q.send
spk_0 I get an error here and it says the policy of send message is not assignable to policy of never
spk_0 so basically this function here has no policy requirements and you gave it one so that's an error
spk_0 so I can just remove that and it goes away yeah if I add it back it comes if I make if I say I need
spk_0 another policy I get an error because I've oversubscribed right so saying policy of send and invoke
spk_0 is not assignable to only policy of send so it's invariant over its policy statements so
spk_0 it's inferred at the type level but you still explicitly have to provide that runtime value and
spk_0 I like that because it keeps the developer conscious of what they're doing and what they're authorizing
spk_0 in their application does that does that answer your question yeah I think this is amazing the
spk_0 the fact that you can use the layers to for not just like the the layers that an application needs
spk_0 but the layers that are needed from the infrastructure as well and then and then get all the the
spk_0 nice type safety around that yeah it's it's it's it's always like this I sometimes joke and call
spk_0 it the holy trinity I don't really know why I call it that but it's there's it's a cloud
spk_0 application is like this triangulated thing right there's this symmetry between the infrastructure
spk_0 and the runtime they they they are not independent they run next to each other and they they mirror
spk_0 each other so you can sort of see that there's a runtime layer those are your clients so at runtime
spk_0 you need the clients at infrastructure you need the policies and then there's the business logic
spk_0 a business logic infrastructure and clients all come together to form the cloud application
spk_0 they're all separate but defined in relation to each other so that's that's what you can sort of
spk_0 see modeled here and this can be I really like this approach but I could see some people being
spk_0 concerned about weaving together infrastructure definition with application definition but for me
spk_0 I'm always like why did we separate out those two things in the first place yeah
spk_0 he's well at the end of the day it becomes an optimization problem right so do you infrastructure code
spk_0 has a legacy of being very heavy without me it's a lighter but it's still heavy right you've got
spk_0 bundling logics and maybe you've got ES build in there that's not very portable maybe it can't
spk_0 run in a cloud flare worker right maybe can't run in a land of function so there's portability and
spk_0 heaviness but you're right they are the same thing you can't actually separate them us as
spk_0 developers we're just sort of connecting them in our heads and we spend all this time like oh
spk_0 shit oh sorry I forgot the policy you know and you find this all out because they are linked but
spk_0 to it's to to to your point you don't I've shown them in the same file here just to demonstrate
spk_0 their symmetry there's that you don't have to do it this way like I can I can imagine
spk_0 let me bring back my sidebar like I have here's here's the index right so this is actually where we
spk_0 bring it together there'd be nothing stopping you do this right bring all the infrastructure into one
spk_0 place and and then leave this as just purely business logic right so this is my this API value here
spk_0 is just a business logic it doesn't have any of the actual runtime layer so I can execute this
spk_0 in my unit tests this is the perfect thing to grab onto for unit tests but the exported handler this
spk_0 has the client right see I'm saying get the client from the environment so that is perfect for
spk_0 bundling that becomes the bundling piece so you can still separate them if you want to keep
spk_0 infrastructure separate but just remember that they are defined in relation to each other there's
spk_0 no actual disconnection yeah I think that makes sense is like at some point the two need to come
spk_0 together and when and how you do that traditionally has been a source of a lot of pain it's like
spk_0 oh this thing worked locally and I push it into play and now oh I forgot to configure this thing
spk_0 on on my infrastructure side and so it doesn't actually work and you know I'm sure you see so
spk_0 many headlines that identify like outages and from you know whoever on the internet and it's
spk_0 always like oh there was an infrastructure deployment that that was broken and it's like why
spk_0 are these things so decoupled that we can't actually know when there's going to be a problem before
spk_0 we actually go to deploy it exactly because if you think about what is the developer having to do
spk_0 every cloud developer is effectively a compiler for their program they look at their runtime code
spk_0 and they build a mental model of like the resources it needs and then they go and manually
spk_0 write those and there's no one telling them they're wrong the only thing that tells them they made a
spk_0 mistake was deploying to AWS it's the only thing that could possibly know that something's wrong
spk_0 but if you connect all those things statically like I've shown here the compiler can tell you that
spk_0 instantly I guess that's a good metaphor for is that we essentially do dynamic binding to our
spk_0 infrastructure today is the predominant way that we handle that and what we're saying is we can
spk_0 actually get to a static binding between our application code and our infrastructure in a way that
spk_0 allows us to verify before we deploy that the right things are going to be there because it's
spk_0 statically verified. That's right. It comes down to this problem of oh we'll solve this little
spk_0 problem deploying an application and we can hold that in our head and then things start scaling up
spk_0 and up and we're still trying to hold that stuff it's it's almost like assembly language programs
spk_0 like you can do this and then eventually you need a compiler and you know the tooling is what
spk_0 we need to be able to continue to increase scale on these kinds of projects.
spk_0 And people that that idea of look this as a compiler problem has been around for a while
spk_0 like for some of those are programming language called winglang that attempted it right it looks
spk_0 very similar to TypeScript but they modeled they had a concept called pre-flight and in-flight
spk_0 and that was a model of this in-flight is code that runs in the Lambda function pre-flight is code
spk_0 that runs in the infrastructure time very similar to like a Scala macro or a pre-proc pre-processor
spk_0 or what's the what's the other one's you know Scala has similar things like you know the
spk_0 implicit so very similar to Scala implicit but every time you do that you run up against the wall
spk_0 of most people don't want a new language you know we have an amazing language at least I'm
spk_0 obsessed with TypeScript I used to be obsessed with Scala Scala 2 I never didn't stick around long
spk_0 enough for three how can we do this in the language in a principled way and the last missing piece
spk_0 for me at least was effect was how do I capture dependencies between runtime code and infrastructure
spk_0 statically and that is what an effect enables and not to mention all the amazing benefits that
spk_0 effect has elsewise right like I can't wait to build stream processes and sqsq handle is with like
spk_0 amazing declarative retries and type checking of all the errors like oh my god you know there's
spk_0 so many other build configuration I think you're going to be able to get to the place where
spk_0 where configuration you know when you want to like okay this thing calls this thing but I've got
spk_0 to have like the arm or the the domain name you know the URL to this thing yeah like that is a
spk_0 source of a lot of production issues today and essentially you could you could statically then
spk_0 even wire configuration across these different services as well well that that's like I didn't
spk_0 really point that out but that was already in that example so like you sort the end when I when
spk_0 I basically created the land of function infrastructure I added in that wasn't just the policy it's
spk_0 calling it policy might be the wrong word it's actually a binding so that includes permissions
spk_0 and environment variables two things together so that queue that if I call q dot send it knows how
spk_0 to look that up in the environment by its ID which is the benefit of the tag like I used to really not
spk_0 like tags and then I figured out oh it's just it's it literally is a tag it's a reference right so
spk_0 I have a queue it has a logical name if I need to look it up in infrastructure or runtime I have
spk_0 this stable reference for it so that's already in there no it's like a handle that you have been
spk_0 that's right to connect from one thing to another and but without bringing baggage that's the other
spk_0 thing so it's a handle like so if I was to give you a resource instead of a handle you're bringing all
spk_0 the create update delete logic that you don't need in your runtime you just need to know its name
spk_0 so what tags are good for is that decoupling it's like a reference and then there's a mapping
spk_0 between it and some other value where you need in some other context that that decoupling is the
spk_0 closure serialization problem that we were trying to figure out before we don't need to do that we
spk_0 can just decouple with sound principled engineering practices and conventions yeah this is awesome
spk_0 yeah um okay so I've struggled with tags also because I've tried to drill in and see how they
spk_0 implemented them and it seems like it's a solution to the structural typing problem so you need to
spk_0 have an actual name the nominal type name to fire for a thing rather than just oh yeah it's the same
spk_0 shape so it's good enough is that your perspective or do you see it in another way
spk_0 uh I I think it is that it's basically the tag is the nominal type I guess you can say right so
spk_0 yes we have structure we emulate nominal typing with discriminative fields on a on a structural type
spk_0 right so it does it does model nominal types because you want to basically say it's a unique thing
spk_0 and then that handle maps on to something else so I would agree that the tag is the nominal part
spk_0 of the type okay yeah the conclusion but I just thought maybe you had some other insights
spk_0 well the the the the reason why they export the class like I start to do this a lot too is
spk_0 you also want to prioritize user-provided names in your so the string is not enough because you
spk_0 end up with this insane structural type and nothing makes sense anymore
spk_0 clart when you extend the class so it's called a mix in you create the class programmatically
spk_0 now that's why you saw lambda dot invoked function and it's the name of the class the user provided
spk_0 they know what this means in their head so that's another benefit of that's why it's not just
spk_0 const the reason it's class is to give friendly names or at least that's what I like about it yeah
spk_0 this is yeah I think a glimpse of the future and I think what you mentioned with like wing and
spk_0 and some others is there's been some attempts but for me what what makes this
spk_0 totally viable is the fact that it's built on type script like you didn't have to go
spk_0 invent a whole new programming language to get there and then it's built on effects which are
spk_0 able to model the dependencies model the not just the inner application dependencies but the
spk_0 dependencies to the infrastructure as well and then and then being able to
spk_0 um yeah create all the like plumbing that's in the middle of those things whether it's configuration
spk_0 or I am policies or I'm sure you'll get to vpcs if you haven't already and so so all those
spk_0 pieces that need to come together but one of the things that I wonder about is we there's a lot
spk_0 of different ways like on AWS that you can run your your stuff and how explicit should we be in our
spk_0 our iCeer and in alchemy effect about the the actual run time that this thing runs on like where
spk_0 should that go so as an example like like with the lambda you could specify like memory uh how much
spk_0 memory the the lambda is gonna get or what incidents type it runs on or you know some of those those
spk_0 more operational pieces and then have where where should that kind of information live yeah just
spk_0 just off the top of my head I would say things that are invariant for example whether a queue
spk_0 is five four or not should go on the tag so anything that's invariant goes like think of the tag as
spk_0 the most static part of the application it and I'm sorry I don't know why I can't kill my discord
spk_0 given that notification apologize for that um static unchanging things go on the tag changing things
spk_0 all the way to the actual part where you make the infrastructure lambda dot make for example
spk_0 so even with I didn't show you the queue consumer right so a queue can be consumed from a lambda
spk_0 function but it can also be done on an EC2 instance right that is even deferred to later you define your
spk_0 business logic independent of whether it's a lambda function or whatever and then right at the
spk_0 last moment you decide I need a lambda with this time out with this memory or I wanted on an EC2
spk_0 in this vpc with this instance type and this many parallel or something like that so I would say
spk_0 changing things at the end unchanging things at the beginning yeah yeah and then your your deployment
spk_0 procedure in this case is just to do like alchemy deploy or something and then your lambdas all get
spk_0 created your vpc's your I am roles like all that stuff just just magically gets you know because
spk_0 it needs to be in a graph you know there's there's the dependency graph of that um then it just
spk_0 alchemy deploy or whatever is just gonna magically do all that for me it yeah well uh so I'm
spk_0 building the primitives in code as just functions that create effects right so there's a function
spk_0 called plan and plan takes an array of those infrastructure pieces that you you know lambda dot make
spk_0 queue dot whatever um so you pass those into plan that creates an effect that will create the plan
spk_0 you could then imagine providing a layer which is like approval auditing you know you could swap out
spk_0 different sort of policy checks for permissions there and then there's another one called apply
spk_0 so an apply takes a plan and then gives you an effect that provides all the infrastructure and
spk_0 that has all the types so the function URL and all that so it infers all the types and then finally
spk_0 if you call effect on run promise on that it will actually do the work of deploying it um and
spk_0 you can do that manually in code I'm a big believer in library primitives first CLI seconds so
spk_0 but I could also imagine skipping those things into far letting the CLI put in the plan in the
spk_0 so you're running a typescript program right that's right that's the way that you you would apply
spk_0 the infrastructure change is yeah you're it's gonna all be in an effect but then you effect run
spk_0 promise and and you run that typescript program and boom your your infrastructure data provisioned
spk_0 including your lambda functions and everything that's needed and I really like one thing I think is
spk_0 really or at least something I really hammer on is I've always hated CDK and poloomy because they
spk_0 never let me get access to the data you know like it has a function URL I've got to go through some
spk_0 abstraction like outputs and exports just to log the URL where effect on run promise just
spk_0 finally materializes that lazy pure data structure which is your infrastructure materialize it
spk_0 just gives it to you you can log it out normally I think that that is a important
spk_0 property to keep and something that I really pushed on early without me even though I did it with
spk_0 async functions was it's an async function because I want you to have the data I don't want you to
spk_0 have some lazy representation of the data you don't know what to do with you can't await no I'm
spk_0 going to give you the data the only problem with that was we lost planning and when you lose
spk_0 planning I think you lose enterprise I think you lose you know a big a really valuable portion of
spk_0 ISC which is being able to review and audit the changes so with effect I think we get the best of
spk_0 everything we get the laziness we also can get the data and we get primitives that are in pure
spk_0 typescript that don't bring any baggage along with them so nice and then on the cicd side the
spk_0 the story is the same I don't have to have like something weird or different to support cicd I
spk_0 just take that typescript program and I run it my cicd and boom I've got my deployment of infrastructure
spk_0 and and all of infrastructure the application and yeah provision the the infrastructure that needs to
spk_0 be for us and I think there's a big story developing here that I'm very excited about which I
spk_0 called version controlled infrastructure so the closest thing to this was unison language which is
spk_0 a compile is a program to content every function is content addressable so you can imagine it as
spk_0 like this you can always look at any of maybe a couple of years ago now to talk about unison but
spk_0 you love love unison like like they're I think the directionally they're headed in the same
spk_0 direction as what you're trying to achieve just very different ways to get there yeah the hotpot
spk_0 is getting the primitives right like how like version controlled data is a hard thing right but if
spk_0 you're using neon and planet scale they now have primitives called branch right so if we start
spk_0 building some of those things into AWS if they start providing branching one thing that we already
spk_0 do in Cloudflare is like every branch gets its own copy of the infrastructure like a just like
spk_0 you a net before I 10 years ago came out with preview URLs for your website see it before you
spk_0 approve it right and it's like wow this is so great I want that for infrastructure and data like
spk_0 let's just go all the way like there and I can always I should always be able to go back and look
spk_0 at the state of the data and the application as of that deployment so I think that's like
spk_0 to commit ID so that was one of the things that Heroku was was I think novel at that time was
spk_0 you should never deploy anything that isn't associated with a commit because you want to know
spk_0 exactly what the state of your source code was in correlated to the thing in production and yeah
spk_0 just drives me crazy when people like I don't know uploads zip files to Lambda there's a lot of
spk_0 funky things that go on yeah but you could imagine getting take the plan and the static statically
spk_0 defined policies and integrate that with a commit and just provide version controlled change
spk_0 log of all your infrastructure and if it doesn't build that it's invalid infrastructure there's a
spk_0 very cool story developing it yeah absolutely super exciting what what else
spk_0 here's a side question so you're doing this on your own well I have a small team actually
spk_0 that I put together and I just closed a small fundraising round of a million dollars
spk_0 so I'll probably announce that soon you know it's well you know I look around and I see AI apps
spk_0 raising like 40 million to I don't know do so you know I feel but like you know hey it's I'm
spk_0 very grateful it's great it allows me to focus on this problem for a few more years and I think
spk_0 you know as we develop this out in a few months this will be working I think we'll have people
spk_0 playing with it yeah yeah I hope so I'm very interested to see what people think about the effect
spk_0 thing yeah one side I'm nervous on the other side I'm like this is what was required to do this
spk_0 like this idea of infrastructure from code has been around a while and it's kind of always failed
spk_0 and I think the big reason is people are like I don't want to change everything I'm doing just to
spk_0 adapt to your infrastructure right like there's not a big enough reason to to go rework your brain
spk_0 to think in terms of these frameworks but now effect has broken that inertia they had a good
spk_0 enough compelling reason to rethink how we built stuff that wasn't just syntactic right it's
spk_0 it's semantic it's it's it's real tangible benefit so with that piggybacking I think infrastructure
spk_0 from code but I think infrastructure as a fact way better name infrastructure as effect can finally
spk_0 right I think there's a new way of coming my concern has been well been in going from
spk_0 scholar to typescript is and as I have dug into typescript is that I feel like yes there's a vast
spk_0 number of JavaScript and not as many typescript programs with programmers but still a vast number
spk_0 and yet it's almost like the early days of C++ when people are programming in C instead of C++ which
spk_0 is that was the attraction how you could get people in and yet when you start digging into the
spk_0 more sophisticated or odd features of typescript I feel like most people don't have you know
spk_0 this tiny fraction of people really understand the depths of typescript yeah so my concern is that
spk_0 effect uses these things seems like it uses the whole language on all the little
spk_0 depth of pieces and I'm just wondering how many people are going to be able to to truly
spk_0 grok that yeah well I agree you know like it it takes a top tier typescript developer to build
spk_0 effect but if you know you look back at the thing for example the class like this little thing
spk_0 of a mixing class that that that they're using that's a subtle little detail to cater to
spk_0 non-typescript developers because it reduces this big complex type to a name and then people know
spk_0 type names so I think there's an art here and I think effect is doing well and we'll continue to do
spk_0 better and it's something I'm focusing on a lot is yes use the language to solve these problems but
spk_0 you provide a nice experience to the user they get to float on top and just they replace a weight
spk_0 with yield star and the rest just flows right or at least I hope that that is what we get to so I
spk_0 I agree but I also would say not that AI is going to take over or anything like that but for AI
spk_0 programming effect has real benefits right declarative errors aesthetic errors and declarative retries
spk_0 so easy for AI to generate how many times is AI generated a retry back off for me and it's
spk_0 this is gnarly right so there's also an argument to be said of
spk_0 just more AI generation helping with using these tools but yeah I think there can be one thing
spk_0 we haven't seen on that yet but will is when we have MCP servers and I know there's now the MCP
spk_0 server for effect which I've tried and it's pretty helpful but I think it can even go a layer further
spk_0 where it would have knowledge of the layers of the error types of all this kind of stuff and even
spk_0 hooks into the compiler that would allow it to the AI to actually have much better knowledge of
spk_0 the types and the structures and everything that's that's being written and be able to provide even
spk_0 better code you know assistance than than what it does to the player and I also think as we get to
spk_0 the point where we can develop custom LLMs that are small and focused and can run locally
spk_0 they'll be able to be much more helpful in explaining some of these a generating the things but then
spk_0 also explaining what's going on so that people can can understand it that way. So on the on the
spk_0 MCP server side, Scala has actually been one of the places that's been pushing this like deep
spk_0 integration between the Scala MCP server and the compiler and so that then the MCP server can
spk_0 essentially be like hooked into phases of the compiler which they can allow the AI that's using
spk_0 that MCP server to get better error messages earlier like ASTs like why not give the AI the
spk_0 like AST of something so yeah I think there's a lot of innovation that'll happen that the effect
spk_0 and typescript have a lot of opportunity around. I think I think even typescript announced that
spk_0 part of their move to go was so that they could do more static analysis for AI that was in
spk_0 one of their blogs and I think one thing we'll see as well we're already starting to see is
spk_0 you know building Linters for AI right so with typescript moving to go there's already an ESLint port
spk_0 in Go and the reason why that's important is because you can use the type system for your Linters
spk_0 not just syntactic building it's type system limiting and you also have the effect language
spk_0 service plugin which does work to clean up some of the error reporting to make that a little bit
spk_0 more digestible for people so you'll just see I think you know AI have you it's like a train it
spk_0 needs to be put on a rail and those rails are the type system and Linters right and that information
spk_0 that keeps it on a rail and it also can provide information to help debug so that can help answer
spk_0 the you know how do people who are less experienced work with the tools but I still also think
spk_0 designing the the the the the type script framework developer must keep this in mind and make sure
spk_0 that all their errors and all their types actually exporting clean ways not here's a crazy 45
spk_0 different definitions of the structural type right most people just glaze over that so yeah and
spk_0 you'll notice like my policy error messages for example almost look exactly what cloud formation
spk_0 will tell you land dot invoke function of this is not a scientific yeah that's that's pretty normal
spk_0 that doesn't look too crazy yeah and at least to me you can get those at essentially compile time
spk_0 instead of waiting in hours to get your cursor can see it now I don't have to I don't have to
spk_0 build an MCP cursor can see it already and presumably we'll be able to move from not assignable to
spk_0 to something that more meaningful right yeah hey hey you forgot this policy you're missing this
spk_0 policy yeah yeah because not assignable to I'm gonna have to go through oh what is it how do I
spk_0 think this yeah yeah I don't I don't know actually what the problem is yeah I you know I think
spk_0 effect also offered something like that they're doing something for the errors already they're
spk_0 cleaning up the error messages and Michael and Aldi said something like oh we could maybe do something
spk_0 for the policies as well so I don't know what that looks like but I can imagine grab those types
spk_0 reframe it into you're missing this policy did you forget lambda dot invoke function right
spk_0 yeah zero does that a lot it was kit that is now at effect who added a lot of the the really nice
spk_0 error messages right yeah so it's like rather than going yeah wait I couldn't do this it's like
spk_0 here's what's wrong yeah yeah way better yeah so we'll probably see that yeah we need to interview
spk_0 kick well because we had them on once I think oh I know that was why he's a while ago and I want to know
spk_0 his perspective on on a effect and be just type script anyway a bunch of you you'll have interesting
spk_0 kit kit kit's videos are amazing I'll be following yeah yeah I was like oh I've never seen this
spk_0 approach before yeah yeah so good yeah all right Sam well thank you so much for alchemy and all
spk_0 you're doing there I think it's really helping the world move forward into a much better place and
spk_0 hopefully alleviating all all of my issues with IEC so yeah thanks thanks for having
spk_0 just grown and oh you just had against things for hours anytime I haven't gone to IEC land I am
spk_0 it's just like going into the pancake oh yeah it hurts it hurts and I don't want I don't want it
spk_0 to hurt anymore so yeah I'll come in effect I think it's a place where it doesn't hurt anymore
spk_0 I'll do my best but then we'll have something for you to try very shortly I'm I think you know
spk_0 by the end of the weekend I'll have the showing the plan and the nice to me with like the deployments
spk_0 and I'll put it out of branch and you can start playing with it we'll appreciate it anyway
spk_0 all right well thank you thanks guys thanks for having me on yeah see you guys later