spotifyovercastrssapple-podcasts

elm-codegen with Matthew Griffith

Matthew Griffith joins us to discuss elm-codegen, a tool for generating Elm safely and conveniently.
September 26, 2022
#66

Transcript

[00:00:00]
Hello, Jeroen.
[00:00:01]
Hello, Dillon.
[00:00:02]
You know what I love to generate?
[00:00:06]
Good content?
[00:00:07]
I do love generating good content.
[00:00:09]
I love generating ideas.
[00:00:10]
I love generating code.
[00:00:13]
And I love generating buzz.
[00:00:15]
And you know who's really good for generating buzz?
[00:00:18]
It's our good friend Matt Griffith.
[00:00:20]
Matt, thanks for joining the show.
[00:00:22]
Oh, man.
[00:00:23]
Thanks for having me.
[00:00:24]
That's probably the best introduction we've done so far.
[00:00:28]
That was pretty good.
[00:00:30]
Yeah, it did not go where I thought it was going to go.
[00:00:32]
That's great.
[00:00:34]
Could the editing team please add bells and whistles to...
[00:00:38]
Yeah, right.
[00:00:39]
Like, cheers in the background.
[00:00:41]
Absolutely.
[00:00:44]
Matt, I think this is a long time coming.
[00:00:47]
We've had you on for some game show episodes, but not for a topic.
[00:00:53]
So here we are.
[00:00:55]
Yeah, here we go.
[00:00:56]
I'm excited.
[00:00:57]
Yeah, I'm glad to be here.
[00:00:58]
This is awesome.
[00:00:59]
Yeah, I'm excited about your cranking out some projects right now.
[00:01:06]
So what are we talking about today?
[00:01:08]
Yeah, there's been a lot on the back burner for a long time.
[00:01:10]
So now it's like, okay, time to get them out.
[00:01:13]
Like, let's do this.
[00:01:15]
Yes.
[00:01:16]
Yeah.
[00:01:17]
So what are we talking about today?
[00:01:18]
Yeah, let's talk about it.
[00:01:20]
We are talking about Elm CodeGen, which is the first of these projects
[00:01:24]
that needs to get out there.
[00:01:26]
Yeah, shall I give like a high level overview of what it does?
[00:01:30]
Yeah, that would be excellent.
[00:01:31]
What the heck is it?
[00:01:33]
Yeah, so Elm CodeGen.
[00:01:34]
It's two things, actually.
[00:01:36]
So it's a command line tool, right?
[00:01:38]
And it's also an Elm library, and you can use either of them.
[00:01:42]
And essentially what I wanted is I wanted something to generate Elm code
[00:01:47]
that was more convenient than string templates
[00:01:52]
and less of a pain than ASTs.
[00:01:57]
I realized that last point might be like a little bit of a spicy point,
[00:02:01]
and there's some interesting like kind of area to navigate there.
[00:02:04]
ASTs are great, but like the question was, could we do better?
[00:02:08]
And specifically, I was like, okay, if when someone wants to do CodeGen
[00:02:13]
for like a tiny thing, if they reach for this versus just reaching
[00:02:18]
for a string template, like string replace, right?
[00:02:21]
If they believe just sort of in their gut that that's more convenient,
[00:02:26]
then I've won.
[00:02:27]
And separately, if you could build some sort of larger project,
[00:02:30]
something very more abstract, and have it be more maintainable
[00:02:35]
than having to juggle a raw AST, that would be a major win.
[00:02:40]
And if I could do both, it would be just a very cool project.
[00:02:43]
I feel a bit confused.
[00:02:45]
Like, do you know about any code generation tools that use ASTs
[00:02:49]
where you actually have to construct ASTs to generate code?
[00:02:54]
I think it would be the default.
[00:02:55]
I think, yeah, for sure.
[00:02:57]
Like if you go to the TypeScript compiler, like to generate TypeScript code,
[00:03:02]
you have a little factory.
[00:03:04]
Oh, yeah.
[00:03:05]
But like it's a very open ended, you know, there's not much judge there, right?
[00:03:12]
It's like, here are all the options for this AST thing,
[00:03:17]
and you just have sort of this massive surface area, right?
[00:03:20]
Yeah, I remember playing with it with LMMtimized Level 2.
[00:03:24]
Right, that was my experience as well, right?
[00:03:27]
We're trying to like, and there's maybe like two aspects to this
[00:03:30]
because there's reading ASTs, right, which is its own certain level of complexity.
[00:03:35]
And there's writing them, which has its own separate set of complexities.
[00:03:39]
So, okay, maybe this is a good point to sort of,
[00:03:43]
because it's easy to jump into the details here.
[00:03:45]
Like maybe the motivating examples,
[00:03:49]
because I didn't actually set out to make a code gen tool,
[00:03:52]
or like that's not where it started, right?
[00:03:55]
So where it started and what I was kind of interested in is there were two projects,
[00:04:01]
one for work and one that I just wanted out there,
[00:04:04]
but maybe relevant to work that I wanted.
[00:04:06]
It's been on my mind for a while.
[00:04:08]
And one of them was, I was really curious to build GQL 2.0 sort of compiler, right?
[00:04:14]
Read a little GQL query or mutation,
[00:04:17]
generate some really nice Elm code that you could interact with.
[00:04:21]
So, and there's a whole discussion there that I know Dillon will have.
[00:04:26]
Yes, we would love to have you on for that.
[00:04:29]
And just to clarify for anyone who doesn't know GQL, you're talking about GraphQL.
[00:04:33]
GraphQL, that's right.
[00:04:34]
That's right.
[00:04:35]
So there's like, okay, I want to be able to generate some code,
[00:04:38]
like reading essentially a query,
[00:04:41]
maybe do some checking and generate some Elm code.
[00:04:44]
That's a decently complex operation actually.
[00:04:46]
So it's kind of a pretty abstract use case.
[00:04:48]
It's not quite as abstract as maybe your own,
[00:04:51]
you're used to dealing with Elm review being like Elm review fix of like,
[00:04:55]
we're going to map a full AST to a full AST, right?
[00:04:59]
Here we're taking a smaller input.
[00:05:01]
It's not that much smaller, but it is smaller.
[00:05:03]
It's the AST of your GraphQL, either your query or the schema,
[00:05:07]
maybe doing some things like checking,
[00:05:09]
type checking it saying like, okay, like you're only asking for fields you expect
[00:05:14]
and then generating some Elm code.
[00:05:16]
So you're still getting the AST on the generation side.
[00:05:18]
Yeah.
[00:05:19]
Just to clarify Elm review doesn't work with,
[00:05:21]
you don't give it an AST, you manipulate the strings.
[00:05:25]
What?
[00:05:26]
Yeah.
[00:05:27]
Fixes are just changing, inserting, deleting strings, which is...
[00:05:34]
That's interesting because it's not, you're using Elm syntax though, right?
[00:05:38]
Yeah.
[00:05:39]
But if you replace some parts of the AST by other AST,
[00:05:45]
then you lose formatting, you lose comments.
[00:05:48]
Okay, fair.
[00:05:49]
Yeah.
[00:05:50]
And the thing is if you do it with strings, string manipulations,
[00:05:54]
then that's easier to understand for other tools like a language server.
[00:05:58]
And you can still use AST replacements by having an AST to string function.
[00:06:06]
Yeah, like a lot of people use Elm syntax DSL to generate a string that...
[00:06:11]
And then use the string as interrupt format kind of a thing.
[00:06:14]
Yeah.
[00:06:15]
Yeah.
[00:06:16]
That's really interesting.
[00:06:17]
I did not know that.
[00:06:18]
And then the other project that I was interested in to sort of anchor it here
[00:06:21]
was I was interested in generating like design systems for Elm UI.
[00:06:27]
I think with Elm UI, if you're not familiar with Elm UI,
[00:06:30]
it's a little sort of library for like a layout language that you can use instead of CSS
[00:06:37]
that basically will generate some CSS,
[00:06:39]
but maybe has some characteristics which make it easier to think about.
[00:06:43]
But one of the missing pieces I found with Elm UI, I'm like, okay, well, you know,
[00:06:47]
but what do I want with Elm UI?
[00:06:50]
I really want people to...
[00:06:52]
I want the experience to be they, you know, they're like, I would like to use Elm UI.
[00:06:55]
And then immediately they have...
[00:06:57]
They maybe make a few high level choices of like, I would like pastels, right?
[00:07:02]
And I would like a dark mode and I prefer like a serif font, right?
[00:07:07]
That's tastefully chosen.
[00:07:09]
And if they could just have a set of Elm code that was like, okay, well, you know,
[00:07:17]
here's a nice color palette like that we know works together.
[00:07:20]
Like here's a nice set of a spacing scale, like for like, you know,
[00:07:25]
paddings, like to have paddings and like font sizes and spacing between elements,
[00:07:30]
all sort of just naturally work out.
[00:07:33]
Like creating design systems, there are certain set of rules that are pretty well
[00:07:37]
known at this point.
[00:07:39]
So you can actually have a fairly constrained set of inputs and generate
[00:07:42]
something where it's like, okay, great.
[00:07:44]
You just have a design system now and you can interact with it and you can have a
[00:07:50]
beautiful app kind of right out of the gate.
[00:07:53]
That was something that I think the JavaScript community has more tools that
[00:07:58]
are like that, where you have something beautiful out of the gate.
[00:08:01]
Elm UI is not that.
[00:08:03]
It's actually like it's more about the logic of your layout, which is
[00:08:07]
intellectually really cool.
[00:08:09]
But ultimately, to thread the needle, you want somewhere it's like, okay,
[00:08:14]
they've made something and it's beautiful and hopefully even more beautiful than
[00:08:17]
what they would do just, you know, if they were left to their own devices or whatever.
[00:08:23]
So where would Elm CodeGen fit into this exactly?
[00:08:27]
So for that, it would be you create some sort of higher level design language,
[00:08:32]
like your color palette, spacing palette.
[00:08:35]
The term, like to think about this language, you would look to terms that
[00:08:39]
designers use to sort of describe design systems.
[00:08:41]
And then you would generate a bunch of Elm code and you would kind of have these
[00:08:45]
values baked in and then you can get this sort of, it's not really a guarantee,
[00:08:49]
but maybe like a sign, really a soft guarantee.
[00:08:51]
But it's like if you're only pulling from this generated, you know, UI theme
[00:08:55]
file, you have this pretty good thing of like, you know, when you're straying
[00:08:59]
outside of your design system and you know that if you use things from this
[00:09:02]
file, it's just going to or set of files, it's just there are just going to work.
[00:09:06]
So again, so it's taking like, and with CodeGen, I like to think of like, yeah,
[00:09:10]
inputs and outputs.
[00:09:11]
So GQL, it was the GraphQL schema and your queries and mutations to Elm code.
[00:09:17]
In this case, it would be like some high level design language.
[00:09:21]
Let's be fair, I haven't done this yet, right?
[00:09:23]
But it's more just in conceptual phases.
[00:09:25]
And then you take that and you'd be able to bake in these values into some
[00:09:29]
generated Elm code.
[00:09:31]
So those were kind of, and also just I found that there were tiny little CodeGen,
[00:09:36]
you know, tasks that I'm like, oh, if I could generate some code, this would
[00:09:39]
actually be really, really nice.
[00:09:41]
Like, but this is such a small thing as this even like a project.
[00:09:45]
And I'm like, and I've noticed that I think other people have these ideas too.
[00:09:49]
And so having it, so an example of this is like, well, you know, we at Vendor,
[00:09:53]
we, you know, we have our design team and they're working on stuff and the
[00:09:57]
design team lives in Figma mostly.
[00:09:59]
And so they're creating artifacts and everything.
[00:10:02]
And one of the things we found was, well, we have our own set of icons there
[00:10:05]
and we wanted to be able to have our icons and color them dynamically and,
[00:10:10]
you know, programmatically, right?
[00:10:12]
So it's like, okay, we want the X, but we want to turn it red or like,
[00:10:15]
you know, whatever.
[00:10:17]
And so it's like, well, that's actually like, how great would it be to just
[00:10:21]
make a Figma API call and say like, hey, give me all the things in this like
[00:10:27]
little box, like that have been squared, like that are inside this physical,
[00:10:32]
I forget what Figma calls things, but like that are all grouped together
[00:10:35]
in some sort of way, give me all of them.
[00:10:37]
And I'm going to create a Figma.icons file and of the way to reference it in
[00:10:44]
Elm code and maybe a few like little options I can switch.
[00:10:47]
I want the large version, I want the small version.
[00:10:49]
I would like the, you know, success versus failure colors or something like that.
[00:10:53]
So little, little deep, like little things where it's like, okay, someone
[00:10:57]
could build a common tool for everybody to do that.
[00:11:01]
And that's fine, but it's less of a project that, I mean, maybe that would be like,
[00:11:05]
maybe there's a general project there, but I'd love to be able to, it's like,
[00:11:08]
oh, it's very easy just to whip something like that up.
[00:11:10]
I'll take a day, I'm just going to do it.
[00:11:12]
And then we never have to worry about it.
[00:11:14]
Yeah, it's really, really exciting.
[00:11:15]
So I think I'm hearing like that I'm hearing two sides of this equation.
[00:11:21]
Like one is you're talking about having a more constrained way to generate code
[00:11:26]
to make it feel safer and easier.
[00:11:29]
So like doing string templating works, but it's, you can create invalid ASTs
[00:11:35]
using things AST based things like Elm C syntax DSL constraints that further.
[00:11:41]
So you can only generate valid ASTs, but valid ASTs might be invalid programs.
[00:11:46]
And then Elm code gen helps reduce that space a little further.
[00:11:51]
And so we haven't gotten into this, but with the help of sort of some generated
[00:11:56]
placeholders for installing quote unquote, installing Elm packages and it sort of
[00:12:04]
knowing the APIs and giving you generated code, meta generated code.
[00:12:10]
Yodog, I heard you like generated code.
[00:12:12]
Basically it gives you generated code to build generated code in a safer way.
[00:12:16]
So you're, so on the one side you're constraining things more to reduce friction.
[00:12:21]
And on the other side, you're giving like a CLI tool because it's kind of a pain to,
[00:12:28]
to build up the boilerplate for, okay, I need to run a little node JS application.
[00:12:33]
I need to spin up my own code.
[00:12:35]
I need to template some code.
[00:12:37]
I need to output that to a file.
[00:12:39]
And you have a CLI that helps you just kind of like Elm review.
[00:12:43]
You have a review config.
[00:12:45]
In code gen you have your generate.elm file and you run Elm code gen run and it generates Elm files.
[00:12:54]
Yeah.
[00:12:55]
Yeah, that's, that's right.
[00:12:56]
There's so the way I think about it and it's great.
[00:12:59]
This is like a preview of my strange loop talk.
[00:13:01]
So there we go.
[00:13:02]
I was literally writing slides this morning about this.
[00:13:05]
So you think about like a, a sliding scale of, of safety.
[00:13:12]
So on the left, right, you have strings, right?
[00:13:17]
And the only thing that strings are guarding against are, is that you're encoded in like, you know, UTF 8.
[00:13:24]
And even then, maybe not, I don't know.
[00:13:26]
Even you go with just numbers, just one giant string of, of.
[00:13:30]
Yeah, right.
[00:13:32]
Strings like so, but inherently flexible and you can build as is obvious if you were, you know,
[00:13:40]
trapped in a room and you needed to build a tiny little like cogen thing and you had nothing else,
[00:13:47]
you'd probably like have strings and do some replacements or what.
[00:13:51]
It's powerful.
[00:13:52]
Are these nightmares that you have being trapped in a room?
[00:13:54]
I have very, very weird.
[00:13:57]
Yes.
[00:14:00]
The saw version of, of generating code.
[00:14:04]
Yeah.
[00:14:05]
To get out of this room, you have to build a cogen tool.
[00:14:07]
Oh, good.
[00:14:08]
I know how to do that.
[00:14:12]
Basically. Yeah.
[00:14:13]
So, so, okay.
[00:14:14]
So strings are on the left and they are the least safe, but immediately this convenience, like sliding scale is both talking about safety,
[00:14:25]
but it's also talking about convenience.
[00:14:26]
There's like this strings inherently portable, inherently convenience.
[00:14:31]
There's some safety stuff, but like you may or may not care about that depending on your use case.
[00:14:37]
Like, so it's like, okay, cool.
[00:14:38]
And just to like acknowledge that that's a valid choice.
[00:14:42]
It's not like more abstract is not always better.
[00:14:45]
There's there are trade offs always.
[00:14:47]
So then you go one, one notch further and you're like, okay, great.
[00:14:50]
I have an AST, an abstract syntax tree.
[00:14:54]
How cool is that?
[00:14:55]
Like we've now modeled the syntax in a tree and what we're guarding against is it's syntactically valid, but it's like, okay, that's cool.
[00:15:02]
We're still missing a few things.
[00:15:04]
One AST is tend to have a very large surface area.
[00:15:07]
Elm is actually pretty great because its surface area is smaller, but even for Elm, it's so small within AST.
[00:15:12]
It's actually still pretty big just because AST is necessarily sort of need to represent a base number of constructs unless it's a very, very simple language.
[00:15:22]
Right.
[00:15:23]
So it's like, okay, even in the simple case, it's still a lot of surface area.
[00:15:26]
And you like, so let's go one notch further.
[00:15:29]
How can we get more safety?
[00:15:31]
Like from an AST.
[00:15:32]
It's like, well, we have to sort of protect it a little bit and we have to maybe process it a little bit.
[00:15:37]
So now we're getting into the area where we're actually going to pretend to be like a little bit more of a compiler ourselves.
[00:15:45]
I'll look at the AST and do some stuff.
[00:15:47]
So the first thing is like, well, can we get imports to always work?
[00:15:52]
Like if you're generating code, if you want to start using a value and it's from a different module, how do you like?
[00:16:00]
It's like, well, before you have to think like, okay, I'm generating and you like this especially happened for the Elm GQL thing that I've been working on is like, okay, this file is going to reference that code and I'm going to like call this value or whatever.
[00:16:16]
I mean, like, okay, well, I'm going to make the call and then I'm separately and it's total other part of the code base.
[00:16:21]
I'm going to make sure that it's imported.
[00:16:23]
And you sort of sit there and you're like, well, but that's kind of dumb because I already like the AST has that information.
[00:16:32]
It's not even like that hidden, right?
[00:16:34]
So can I just before rendering, can I just grab like what values did you use?
[00:16:39]
I'm going to assume that they exist and I'm just going to import them.
[00:16:42]
So it's like, okay, that's one notch farther than an AST.
[00:16:44]
We've processed our AST a little bit to give us some safety.
[00:16:47]
We have this thing of like, you can't screw up your imports.
[00:16:53]
Like that's cool.
[00:16:54]
Okay, but and like, how can we go farther?
[00:16:56]
And this is where things change.
[00:16:58]
Like where I think the key insight for Elm Cogen kind of came where I think what makes it much more useful.
[00:17:05]
Like if I would have stopped there, I think it would have been pretty cool.
[00:17:09]
But there's a lot more value still on the table, which is like, okay.
[00:17:14]
I want to call a function from another module.
[00:17:19]
Or I want to generate.
[00:17:21]
I have to be careful because it's like we're getting into inception land where it's like, okay, are you talking about the code?
[00:17:27]
Are you talking about the code that generates the code?
[00:17:29]
Yeah.
[00:17:30]
You need to be more meta.
[00:17:32]
Yeah.
[00:17:33]
So I want to generate a piece of code that calls a function from another module.
[00:17:39]
Well, in AST land, what you would normally do is you'd have a concept called apply, right?
[00:17:44]
Which is like you say, I'm going to apply these arguments to this value.
[00:17:49]
And the arguments in general is like a list.
[00:17:52]
It's like an open ended list of like, I'm going to like apply X number of arguments to this.
[00:17:57]
So the first thing you'd sort of go to is you're like, okay, well, but I know this function takes two arguments.
[00:18:03]
So I'm going to manually write a little helper.
[00:18:05]
I'm going to write a little function that is going to take that function is going to take two arguments.
[00:18:11]
Behind the scenes, it's going to call apply with list, the unsafe thing, but it's only going to apply it with two values.
[00:18:17]
I know if I use this function to generate a call that I've guarded against something else.
[00:18:22]
I've guarded against arity issues, right?
[00:18:25]
So it's like, okay, we're one notch at imports.
[00:18:27]
Now we're guarding against arity, like calling a function with a number of values, right?
[00:18:32]
And then the let me maybe the last part is like, okay, but the next chunk is types.
[00:18:40]
Now this is kind of weird.
[00:18:42]
And like, so what I mean by that is like, okay, let's say we have a new function called add.
[00:18:46]
We've just invented this.
[00:18:48]
It's amazing.
[00:18:49]
Takes two numbers, smashes them together.
[00:18:51]
You get another number.
[00:18:52]
Groundbreaking.
[00:18:53]
Yeah, super groundbreaking.
[00:18:54]
In this case, we're going to only operate on integers.
[00:18:57]
Now we could make our little helper function that like takes two expressions, like AST expressions and generates a new expression.
[00:19:07]
And it means that whenever you called that, you'd have to say like, okay, my first argument is an integer.
[00:19:12]
So you say like, this is an integer.
[00:19:14]
And then the second argument is like, okay, this is an integer.
[00:19:16]
And you like kind of wrap it before it goes in.
[00:19:18]
But there's another form of this.
[00:19:19]
Like you can just do that wrapping inside of the function.
[00:19:22]
So you have another helper that basically helper that's like my sweet, sweet add function takes two integers and returns an expression.
[00:19:30]
And then it just does the mapping.
[00:19:33]
And so there we've actually squeezed out another bit of safety because now we can call this my add function with two integers that we maybe know at build time.
[00:19:42]
And we get a expression that generates like what it would look like to call that function normally.
[00:19:49]
So now what I like to think about with this, I realize I've been talking a decent long time.
[00:19:54]
So hopefully I'm spinning a good yarn here.
[00:19:57]
But is that that form, that last form of you have a function add, give it two integers and it returns an expression that is that value.
[00:20:09]
That to me is like very close to being like writing the original code, which means it's very close to writing a string.
[00:20:18]
Like convenience wise.
[00:20:20]
It's also interestingly enough, the safest version of everything we've been talking about.
[00:20:25]
Now, the only downside is that in some cases when you're generating code, you don't always know all the values at build time.
[00:20:34]
Right. Like so like.
[00:20:37]
But what we've done and what I think is so cool is we've taken it from being anchored in the unsafe realm and trying to stretch and reach to the safety where it's like the farther we reach the safety, the more like painful it is.
[00:20:53]
Right. We've actually inverted it.
[00:20:55]
Now we say like by default, you are as safe as we can get in this sort of context and the most convenient.
[00:21:03]
And if you need to be more abstract, you can reach farther.
[00:21:06]
You can say like, I need to oh, I need to call this function with a variable number of arguments.
[00:21:12]
Like if I'm doing a builder pattern or something, something that's actually I mean, it's still relatively common, but it's not it's not the most common thing.
[00:21:20]
So there are ways to basically be like, OK, I can reach into my little tool bag and say, like, I want like the more abstract version because that's what I need right now.
[00:21:30]
But you're anchored in this like concrete type checked version of things or not not completely type checked.
[00:21:37]
There's another discussion, which I'm really curious to bring up of I remember sort of going crazy.
[00:21:43]
Again, this is like the, you know, Matt's, you know, nightmares of like you're trapped in a room like, you know, there's a bomb inside of you and you need to code generate it out.
[00:21:53]
I don't know. And and I kept thinking, like, could you could you make a library that has the thing of like if it type checks, it generates code that type checks.
[00:22:06]
And there was a form of this that I was really interested about.
[00:22:09]
And then and I kept trying to leave the door open to explore that.
[00:22:14]
And we maybe after we come to this area, we can go back to that of what it was. But there's a key insight of why that's not doable without some crazy type level stuff that probably doesn't that you that I think you would need or some other mechanism that someone much more clever than me would need to come up with.
[00:22:34]
Cool. I really want to get into that. But but yeah, to keep it to keep it at level one here.
[00:22:41]
I really like what you're saying about this philosophy of like, just as a broader concept in the Elm community, like, can we have our cake and eat it to as far as like, let's make it safer and easier.
[00:22:55]
Can we can we right it's like, the way I've been thinking about it is, can we leverage safety? And this is I think what what Elm does, it's just like, it's clear to me why it's not.
[00:23:07]
We sort of emphasize type safety in Elm. And I think some people may roll their eyes, which is fine. But I think the interesting insight for Elm and the thing that really struck me is like, let's leverage safety to make things more convenient.
[00:23:22]
Like, like, and that's not always possible. I don't think I mean, how could it be but like, for the cases where it is, it's kind of magical. It's kind of like, okay, you ended up with this thing that is safer, and also better to work with.
[00:23:38]
And sometimes also faster.
[00:23:40]
Yeah, there's a there's a lot there's a lot of things that sort of pile up there. And, and if you focus too much of like, okay, we got the type safety or like, or I'm just gonna have type safety, type safety, blah, blah, blah, blah, blah.
[00:23:52]
If you don't balance it out with that other thing of like, I am looking for opportunities to make this incredibly convenient, you'll you'll usually end up with something that's like, okay, this doesn't not like, what the heck am I doing?
[00:24:05]
You know, like, I'm drowning in types. I don't feel great.
[00:24:11]
There was, um, in my agile coaching days, I felt a similar tension, sometimes in a similar enthusiasm to like, dispel these myths that there's like a common perception that, you know, these these technical practices, like, you know, test driven development, or refactoring code and, you know, having having thoughtful, thoughtfully designed code that you iterate on and all of these things like slow you down.
[00:24:40]
You know, testing my code that's going to slow me down. Now I have to write a test, but it's feedback. It's shortening the feedback loop, and it both makes you go faster. And safety also gives you the confidence to just go and not look back not think about whether, whether you're doing something wrong, or whether, you know, some monster is going to trap you in a room.
[00:25:03]
You know, it's very freeing.
[00:25:05]
Yeah.
[00:25:06]
I, yeah, right. Yeah.
[00:25:09]
I can hear the flashbacks of your nightmares. Sorry to.
[00:25:12]
Oh, God.
[00:25:14]
So yeah, so so maybe to bring it around, like, just because I realized with some with the cogen stuff. It's maybe you're hearing it and depending on your experience, you may be very experienced with ASTs or not, maybe that term is actually kind of arcane and weird, which is fair.
[00:25:33]
It's very abstract.
[00:25:35]
Yeah, kind of what it comes down to practically is if you're like, you know, I really want to be able to generate some code some Elm code that, like, is basically just a view function, like it's some HTML calls.
[00:25:52]
What you would do is you would say Elm cogen install Elm HTML, that would give you this little helper module, you could then use that helper module with just like as you'd use any other kind of local module.
[00:26:06]
And you'd write code that looks a lot like a view function, something you're already doing. And the and then you hit run and you just have that, that would be yours.
[00:26:17]
And if you wanted to get crazier, you can push it farther. And there's some cool things you can do there too. But like, just to anchor the concrete part of this, it's like, it's so easy to be like, okay, here's this high level, you know, thing like, oh, they said it was so convenient and so safe.
[00:26:32]
And it's like, well, but but like, what were they actually doing? Right?
[00:26:36]
Yeah, it basically is trying to mirror what your generated code would look like as much as possible, right? Like you Elm dash code gen, install Elm slash time. And then in your generate dot Elm module that generates your Elm code gen code, you do import gen dot time.
[00:26:56]
And then you do gen dot time dot millis two posix or whatever function call and you millis two posix takes an int and gen dot time dot millis two posix takes an int. And so it looks like the code you you're actually generating.
[00:27:13]
That's right. Wait, it takes an intro or it takes an expression, generate expression.
[00:27:18]
It takes an int. But it correct me if I'm wrong, Matt, but it provides an escape hatch if you want to provide a general expression, but the more low hanging fruit way to consume it assumes it just takes a literal int that you already have.
[00:27:33]
Yeah, so the base assumption, the place you start with Elm code gen is the thing that is most convenient is that you probably and this gets into the use cases, but you probably know concretely the values you're putting into these functions at build time in the most common
[00:27:52]
to in the land. It's always like a gradient rate, like how far you go, right? But the most we want to say, like, okay, 85% of the time, you're going to be doing this. It's like, great, we're going to make that super convenient. Like, oh, you want to like you have an integer already almost by definition, you're
[00:28:09]
you're taking some source, some, you know, source of truth, right? The figma, the figma API, or like a graph qL, like schema, which you have these literal values or, you know, and we can just skip the abstract part, nearly completely, like, we are still generating an expression, right?
[00:28:28]
But, but you provide a concrete values, and you basically get kind of what you were expecting. And like, I think you all of a sudden don't need to think about stuff, which was causing us a decent amount of pain, which is like, imports, like, you use the age, use the time library, oh, it's important.
[00:28:43]
And you probably didn't even work like have to worry that that was like a thing. Hopefully, hopefully you're using this for like a few days, you're like, oh, wait, oh, interesting. Okay. Or like, sometimes, like a library doesn't even need to be important, if it's like list or something. And it knows, in most cases, there's still a few things I need to a few like little subtle bugs like that I need to smash, but like, it'll know like, oh, yeah, list dot map. Great.
[00:29:06]
I love that declarative quality. Does it also help you because so I've I've done a lot of string based code generation in JavaScript, and in Elm to generate Elm code. And so I'm very familiar with the pain points you're addressing, including the creating the correct imports, resolving type signatures correctly for types that you're sort of piecing together, it gets really tricky.
[00:29:34]
Also, like creating parameters that aren't going to have name collisions is, oh, is that also something that Elm code gen helps with like giving you valid parameter names that won't. So it's funny, like in focusing on the convenience, I skipped over like a decent amount that Elm code gen does.
[00:29:52]
Some of it. Yeah, maybe need some love, but it does track naming collisions. Not completely. So top level values aren't checked, you have to verify those. But those are usually pretty easy to verify, like if you have a top level value. And when you get into like building the body of something, it's actually tracking a set of like a scope of basically what values are in there.
[00:30:21]
And basically what values are in scope. And like, and add again, like, if it does detect a collision, it'll add in a little like underscore and then a bunch of numbers, I guess kind of like a little protection thing.
[00:30:33]
But it's not 100%. Like there are still some cases to catch. And like the challenging part with this, and where I was trying to get to is, like, if it doesn't have to protect a variable, it shouldn't. Because we want the code that's generated to be nice to look at.
[00:30:53]
And the primary use case could be generating examples. In fact, there's a discussion we should have about that because there's some interesting stuff there. But the code that's generated, I absolutely want it to be inspectable, like with the Elm GQL utility, which is coming up for release and, you know, however many periods of time soon.
[00:31:20]
We've been using it at vendor for the past year and a half, and it's been incredibly successful. So it's, it's more just like documentation needs to get up. But the idea there was that you'd write some graph QL, you'd write a query, you'd write a mutation, and you'd be able to look at the generated Elm code and looking at the generated Elm code would be like, should be like reading really well written Elm code, it should be very simple, very straightforward.
[00:31:45]
Here are the types that are coming in to run this query or mutation. Here are the types, here's the data you're going to get out. Like you don't worry about decoders, don't worry about whatever, you know that it matches the graph QL schema perfectly, right. And the generated code is part of the interface of that library.
[00:32:02]
It's like you're supposed to look at it, even to the point where what I was talking with was developing this with some of my co workers, like Duncan Malashok, and I were looking at this. And they made a suggestion at a certain point that even with the code being generated, it would be useful if we had examples of running that query,
[00:32:30]
especially if the inputs to that query were a little bit more involved. Sometimes they are, and inputs have turned out to be challenging with graph QL and Elm for various sort of subtle and dumb reasons.
[00:32:43]
And so I went down the whole rabbit hole of generating example code that actually turned out to be pretty cool. You know, you basically you say like, okay, we have this schema, we're going to say, well, you know, Dillon, you made this joke when we were getting coffee the other day, like computer, get me a, get me a, you know, a filter, a person filter.
[00:33:04]
Yeah.
[00:33:06]
And then, you know, you have it run out and try to construct a value. And what we found with construct and so with that example code, what was so nice, and I think is something that what I want as an area for Elm code gen that I'm currently exploring and we'll be talking about at Strangeloop of example code generation and how to leverage that into something as a developer resource, right?
[00:33:31]
So, you know, I think it's like, let's be fair, copying and pasting something, and maybe editing it, or like, tweaking it. I mean, you could be like, that's so dumb, you know, like, go to stack overflow and get a thing. It's like, yeah, but we know that this code is like, on some level, some level correct.
[00:33:50]
And so it's actually very useful to be able to copy and paste and remove some of this, you know, you're like, oh, I don't need that. I don't need that, whatever, whatever. And then you have a thing, it's like, okay, wonderful. Here we go. We actually used that to take it further, like, okay, well, we generate these example calls, basically to make using this stuff useful.
[00:34:11]
Now, some things happened. One, we, so small bit of background with GQL inputs cannot have unions, which means that are certain ways that you want to generate, you want to like provide a input, you want to say like, it's one of these values, and you kind of can't do that.
[00:34:33]
And it's very frustrating. And optional stuff is also weird, because it's actually sort of inherits the JavaScript sort of legacy or whatever language legacy of like, things by default are optional. And if it's optional, it's actually a number of states, it's actually either it's not there, or it's there, and it's null, or it's present, right.
[00:34:56]
And the tricky part about that is that present and null is actually a distinct state from absent, and some cases meaningful, but not always, usually not. So, so there are a few ways of handling this in Elm. And I don't really want to get into them because they're, you know,
[00:35:14]
yeah, that's a whole can of worms. And when that actually comes up, but I think it's interesting, using Elm code gen, I was staring at this thing. And I was looking at the example calls, and some of them were pretty big if the surface area was pretty big. But when you're saying that the example calls for the design decisions you've made for your library just becomes very obvious how they scale.
[00:35:36]
You're like, oh, if we handle optional arguments, using the phantom builder pattern or using the like a list of whatever is or like, there are no way of doing this, right. But you can immediately be like, well, this is what a huge query looks like. And this approach looks great when it's small, but oh, boy, there are some weird cases when it gets bigger. And
[00:35:57]
something that would be hard to explore when exploring API span hand, which is the default. So can you elaborate a little bit on how Elm code gen helps you generate examples. So essentially, it, we talked about you do Elm code gen install some package. So basic, and it gives you gen dot time dot whatever the time API is, or whichever package you're using. So you're, you're talking about essentially, using
[00:36:26]
fuzzers to call these types of API. Yeah. So the way the way we are, I originally did it was looking at the source of truth in this case, which was the GraphQL schema. And you're like, okay, I want to make this call to this query. This query takes this input. And what you do is you'd sort of loop over the schema and sort of say, can I make an exhaustive example? And it's like, okay, if this needs a string, I'm just going to put in a string that's called placeholder. If it's a
[00:36:55]
string that's called placeholder, if it needs an integer, great here you get five, you know, so the actual values, you just sort of make something up, just give me something I don't care. And you would kind of like loop over and, and generate calls. So yeah, so you're taking in this case, you were taking the GraphQL schema, and you were using and this is actually with the generated code, it actually exactly where we were. But this is a case where you might want a more abstract version of, of the
[00:37:24]
when we talk about the Elm cogen, like different flavors, right? So it's like the most convenient one is the very concrete one, you might make them use a more abstract version. And so like, in this case, because like the values you're creating, you may not know like, literally. So I'm not sure if that lands for everybody. But so but that's generally what you're doing. And what's interesting, though, and what I'm exploring more recently is actually being able to generate examples for any given
[00:37:53]
piece of Elm code using the like you can for a given Elm package, you can get the what's called the docs JSON, right, which decodes into a really nice type signature for every value in there, which basically the you can think of the docs dot JSON as when you go to the documentation on the Elm package site, and you see the listing of all of the types and the functions and the types that the functions take,
[00:38:22]
that's right, right. So that's the information that's there. Yeah, right. And it's just it's kind of it's just there. If you check out there's a project called project metadata utils, I believe, or something like that, which you ruin I know you're probably very familiar with. And so if you go to like the Elm type module there, you'll see a represent representation of Elm type system. It's just like super great. It's I was thinking about this where I'm like, oh, ASTs in general are like, kind of like the same thing.
[00:38:52]
And I kind of naturally have a large surface area. And I was like looking at that type specifically the type that represents type signatures, as this little this little baby AST, right? It's just like little tiny thing you just want to put in your pocket, right? It's just like, like, you're like, this is so nice. And like, so the thing I've been thinking about it, or I was I'm like, okay, well, we, you know, we did the graph QL example generation. And that was me just sort of figuring it out based on the schema. And because I don't want to get
[00:39:22]
farther away from it, I want to make the point, we also use that example generation on the graph QL side, we were doing a an upgrade to our back end, and we were changing graph QL libraries. And it was one of those things where it's like, okay, we were reasonably, we think it's reasonably good. But, but also, this is a global change to all of our graph QL handling on the back end, which is sort of nerve wracking, kind of no matter where you're at, right? So I was talking with Aaron White, and we were like, how can we get how can we
[00:39:52]
get more confidence around this thing? And I was like, well, have you considered ordering a glass of all your queries? Because basically, we had this example generation, it's like, well, we don't actually, I mean, valid query, completely valid queries, and mutations and everything. It's like, that's, that's good. But we're just testing that the graph QL libraries hooked up correctly. So we just checked, I just took all those example queries and mutations. And I just sent them to the server and said, like,
[00:40:22]
did you blow up? And we did that. And we caught like a few cases, some older parts of the database that had something weird with them. I forget what it was, but it was something. And of course, all the things that were returning was like, what are you talking about, dude? You know, the server was saying, but it's like, no, but the fact that you told me this means I know you're doing all right. Versus versus you just like screaming with your hair on fire, right? So
[00:40:52]
anyway, I wanted to get that point in because I thought it was I think it's really cool. Example generation turns out to be a whole I mean, this is program synthesis, right? It's like, there's a whole set of things you can do with this. So coming back to we went to the little side quest there. We had that cool coming back with that, those types from docs JSON, you have this beautiful little type that sort of represents elm types. I think I've been thinking about that you think about like, what are the sources of
[00:41:22]
information? And what are the inputs and the outputs for your different code gen projects? Like this is actually one that's very valuable and has some advantages over raw ISTs that are kind of huge, right? So it's like a few things one surface area way small, great. So it's very convenient to work on, you still have to do some recursive stuff. But this just the surface area of the recursive stuff you have to do probably not as big. Well, definitely not as big as a normal IST.
[00:41:48]
What do you mean?
[00:41:50]
Well, yeah, you have to like you have, like you'll to represent a function. It's like a lambda call. And then that's like a type and then another type, right? So whatever function you use to generate code using that elm type type, okay, is going to recurse on itself, but it's not going to be it's not going to be too crazy. So and separately, like there's this desire when you're doing code gen, possibly to know some types to operate on types.
[00:42:20]
Or at least like when you have access to it's like, okay, I know for sure that there is a value that has this type. And like, in fact, I know the whole bag of recipes to build these values from this module. Then you have everything you have everything you need to make a example cake, right?
[00:42:35]
Like you just you say you pick a starting point. And you say like, I'm gonna, and you could just pick every point and say like, I'm gonna start wherever and I want to end up, I want to end up with some HTML. Great. So I'm gonna start here. And of course, this thing may fail, right? Me and may not find a way to get to HTML. But it like, you can write an algorithm. And this algorithm is not very involved. 300 lines of code, maybe we say I'm going to start with this value. You're looking at your bag of recipes, you're gonna say like, okay,
[00:43:03]
okay, so you start with it, for instance, or something?
[00:43:05]
Yeah, you start with init. That's a, you know, that would be a natural place to start with some of these things. So like a UI button, right? So you say UI button in it, great. What that maybe, maybe your button module uses the builder pattern. So init does not create HTML, but it creates a button button type. So what you'd say is like, okay, my button takes a record, which has a string and a message, right? So like label and on click, cool, I'm going to make up a string. And I'm going to like, when I see something like message, and we have a little bit of like, just stuff, right?
[00:43:35]
in this like messages, messages, a special case. Then you say like, okay, great, I've created a
[00:43:40]
button. Now that I have a button, what can I do? And then you write a little bit of code to say,
[00:43:45]
like, well, are there any builders that could take a button and maybe a value and modify it?
[00:43:52]
It's like, okay, that's cool. That's cool. It's not that hard. A builder is just a function which
[00:43:57]
takes some stuff and then ultimately takes a thing and returns a thing, right? Great. Really easy to
[00:44:01]
detect when you have this. And then you're like, okay, well, do I have anything? Could I create
[00:44:07]
anything that takes a button and returns HTML? Oh, there's button.view. Great. I'll put that
[00:44:13]
in the end and then I'll claim success. I threaded the maze. Okay. So conceptually, I'm with you
[00:44:19]
about taking this Elm type, which represents a possible Elm type and that represents the thing
[00:44:27]
you see in the Elm package documentation that describes types and functions. And then taking
[00:44:32]
that and solving this puzzle to say, okay, I want to generate something of this type.
[00:44:37]
Here are all the things that are available. How do I create something like that? What I'm not
[00:44:42]
understanding is, is this something that you're just on your own going and taking some docs.json
[00:44:49]
and figuring that out? Or does Elm code gen have something to actually help you with this?
[00:44:54]
That's a wonderful question. So this is something that I'm using Elm code gen to help with. I'm
[00:44:59]
exploring this. Elm code gen does not do this right now. There might be a thing in the future
[00:45:05]
where it's like, maybe this lives in Elm code gen. This could be built entirely on top of Elm code
[00:45:10]
gen. I think there's nothing essential about Elm code gen. It doesn't need to work with internals
[00:45:15]
or anything. So this is more an exploration of what do I find exciting about code generation?
[00:45:21]
And there's this whole territory that sort of opens up when you have something that is convenient.
[00:45:25]
It's like, I'm not worrying about imports, not worrying about type inference. Oh, we kind of
[00:45:29]
forgot to mention Elm code gen does have type inference in it. Like figure out the type signature.
[00:45:35]
There are some limitations to it. It's not as smart as the Elm compiler, but that's fine because
[00:45:39]
the type inference there is a convenience. You can overwrite it if you know it. And it's actually
[00:45:45]
usually not that big of a deal to overwrite it. Let's dive into that a little bit. So
[00:45:49]
at the base level, if you do in your Elm code gen generate module where you're generating some code,
[00:45:58]
if you define a declaration and then in that declaration you just have a, you say, time zero
[00:46:07]
equals time dot millis two posix zero, then it knows the type of that, like the code you generated
[00:46:18]
when you did Elm code gen install Elm slash time knows all of the types for those little generated
[00:46:24]
stubs to help you build using that package. And therefore that declaration, when you generate it,
[00:46:31]
it's going to say time zero colon time dot posix, right? Cause it inferred that.
[00:46:35]
Yeah, that's right. Yeah. So like you'll, you'll add in little values, especially like calling
[00:46:40]
out to libraries and stuff. And ultimately when you render that declaration, it should have a
[00:46:46]
type signature, which is correct, except for a few cases. One, there are some nuances to building
[00:46:53]
type inference. And so there are some, there are some cases that I need to figure out. I think in
[00:47:00]
the general, like to be fair in the Elm GQL, the library I'm working on using the vendor, I work at
[00:47:09]
vendor, which uses, we have 600,000 lines of Elm code, FYI, 300,000 lines of them are generated.
[00:47:18]
But of the 1000 files, or I think it's 1200 or so that are generated, which to be fair,
[00:47:25]
we don't use all of them. And the ones we do use, you only ship values that are used,
[00:47:30]
which is important to consider when generating Elm code. You get, you know, you're not going to
[00:47:35]
bear the burden of a huge like asset size for the stuff that you generate and don't use. So
[00:47:42]
you just don't have to worry about that. But for those 1000, 1200 files that we generate,
[00:47:48]
the type signatures were correct. Like it didn't throw a type signature error for those. So that
[00:47:52]
feels pretty good. But there are cases where it gets confused. I think especially, I think the
[00:47:58]
case where there are going to be cases, which I'm not even sure that there's going to be a way around
[00:48:03]
it, which is when you're heavily using aliases to capture various states. Like it's just,
[00:48:12]
the question is, is just, it doesn't necessarily, like the Elm compiler knows all your aliases.
[00:48:17]
It knows it because it knows your entire project. We don't do, like we do very minimal amount of
[00:48:22]
alias tracking, right? So one of the projects where this shows up that's challenging is Elm
[00:48:27]
CSS because they use type aliases to mimic the constraints of CSS, which is challenging. So
[00:48:33]
there, like the thing you can do is you say like, okay, great. I'll just tell you what the type is.
[00:48:40]
I know what it is. It's actually not that involved. So you can say, you know, for this declaration,
[00:48:44]
the type is going to be this and then we'll be fine.
[00:48:48]
Okay. And you mentioned an escape patch where you can help it along if it does get confused.
[00:48:54]
What is that? That's the with type. Like, yeah. So any expression you can basically say,
[00:49:00]
ignore what you were doing. This is what you are. And then you're in charge. I mean,
[00:49:06]
you're still going to like, ultimately this code is compiled by Elm anyway. So great. Like you'll
[00:49:11]
have to figure it out. Do you have an option to not have a type annotation in case like even you
[00:49:17]
don't know how to, that's a good question. I think so if it errors, it's not going to have a type
[00:49:23]
annotation or at least it shouldn't. There are a few maybe soft errors where the inference is wrong
[00:49:27]
and it's giving the wrong annotation, but that's different. There's no way to sort of say like,
[00:49:33]
don't write any annotation as an explicit statement at the moment. So when the, when it can't infer
[00:49:41]
the type annotation, you won't have a type annotation. Yeah. When you come to find it,
[00:49:46]
infer the type, there won't be a type annotation, but the tool doesn't crash or the tool doesn't
[00:49:52]
say, sorry, I can't generate this code. That's right. We wanted it. Yeah. I think that's a right.
[00:49:57]
And this was something we were thinking about is like, I didn't want my dumb little type inference
[00:50:02]
code, which I'm like, look, this is really just like, if it's, if it works great. Otherwise,
[00:50:09]
yeah, there's ways around us. It's not that big of a deal, but like I'm trying to get to delightful,
[00:50:13]
but yeah, preventing you from generating your code is not delightful. So it will always generate
[00:50:19]
code unless your code doesn't compile. Right. So the original generation code doesn't compile.
[00:50:25]
So the, yeah. So you're delegating the type checking part to the compiler ultimately. Yeah.
[00:50:32]
I wish you have to, right? I mean, like, I mean, ultimately we're going to say like,
[00:50:36]
we're going to try our best, but if, yeah, if we can't figure it out, we're not going to,
[00:50:42]
we're not going to. And then there's, there was even a thing like, I know that there's a bug,
[00:50:47]
which Dillon ran into earlier today, which I'm so glad for, which I actually, in this line of
[00:50:52]
thinking of like, we want to generate your code. Like even if we sort of think that there's
[00:50:56]
something wrong, it's like, we're not the armators of truth right now. L, the L compilers, there is
[00:51:00]
a case in the type inference thing where it will do an infinite loop. Before it was an infinite
[00:51:05]
loop and it'd be like, you know, oh well. It's like, well, that's not great. So the way infinite
[00:51:10]
loops happen is when it's doing type inference, it's looking up like, okay, oh, this is a message.
[00:51:15]
What is a message? Oh, a message is an integer, right? So it does this sort of lookup of like,
[00:51:19]
here's this type variable. What do I know about this type variable? I have a bag of facts about
[00:51:24]
this type variable and I'm going to go and I'm going to try to figure it out. The infinite loop
[00:51:29]
happens when you have a type variable that loops around to itself. So it, it's a variable on it.
[00:51:36]
Like, oh, what is the message? Well, a message is a message.
[00:51:39]
Obviously, yeah. A message is a message is a message is a message. Like that was one of my
[00:51:44]
nightmares. So as if you weren't enough during this episode. Yeah. So, so basically what it
[00:51:52]
will do now is it's actually tracking what type variable names, what values it's already
[00:51:58]
done a lookup for. And if it runs into it again, it's going to give you an error message that says,
[00:52:03]
oh no, I'm not as smart as the UMP compiler, but we're good friends. Like, and I especially get
[00:52:10]
confused in these circumstances, but you know, try to be as like, Hey, this isn't that big of a deal.
[00:52:16]
So this is like, this is not an error. This is a, technically a warning, right? It's not going to
[00:52:21]
stop you. It's just your type signature for that declaration is not going to show up, which honestly
[00:52:26]
is probably fine. Yeah. And I have seen it also give, we're talking a lot about like cases that
[00:52:33]
it's not as smart as the Elm compiler, which is, you know, big shoes to fill, but, but also I've
[00:52:38]
seen it tell me about failures where it's like, Hey, this is supposed to be type HTML, but you
[00:52:44]
gave me a list. I think something's off. Right. So, but ultimately, so it gives you a warning if
[00:52:51]
it encounters something like that and tells you what it thinks the problem was. But then it says,
[00:52:55]
I'm, I'm not the arbiter of truth, like you said. So it still lets you generate the code,
[00:53:00]
but then you can always take that code that it generated and run the compiler on it to make sure
[00:53:05]
it that's, that's the ultimate source of truth. Right. Right. And then there's, yeah, there's a
[00:53:10]
natural like feedback loop there of like, Oh, you know, I ran Elm code gen on this code. And to be
[00:53:15]
very, it's only really giving you like meaningful type inference issue or warnings. If you're sort
[00:53:20]
of in the less concrete area and in the more abstract area, you're using expressions for
[00:53:25]
stuff. And so it'll say like, I tried to unify these two expressions and like one's an integer
[00:53:29]
and one is, who knows. So when that, I lost my train of thought, where were they going? I don't
[00:53:36]
know. And if you call, if you call gen.time.milis2possics, that's, that's kind of a cool case
[00:53:44]
because the type checking is built in where as a compile time guarantee, because it takes an int
[00:53:51]
and therefore if it compiles, it's, there's nothing to even check. It's not, it can't fail.
[00:53:57]
Yeah, that's right. Maybe this is a good time to get into that can of worms that you alluded to
[00:54:02]
earlier about why doesn't it go ahead and, and give like compile time guarantees that you will
[00:54:09]
generate something where the types line up. I love it. Okay. So I'm pretty curious about this.
[00:54:15]
It's, it's fun. Okay. So here, here's what we have. So normally in an AST, you have the AST itself is
[00:54:22]
one type, ignoring the different differences between declarations and expressions. We're just
[00:54:27]
going to focus on expression right now, which is the bulk of stuff. So there's one type and you have
[00:54:32]
an expression and like here's dealing with expressions kind of everywhere. Now, what you
[00:54:39]
could have potentially is because like in, you can have a type on top of expression, which is what
[00:54:48]
Elm Cogen already has. The inner expression is from Elm syntax. There's an outer expression,
[00:54:54]
which basically just has some metadata about stuff, right? So it's actually kind of grabbing
[00:54:59]
a list of imports that is in there, right? Just so it doesn't have to crawl the AST to get them.
[00:55:05]
And it has some other sort of type checking information on there that's not in the original
[00:55:09]
AST. So there's two levels of expressions, right? Now at top level, the one that's exposed that
[00:55:14]
you're most when you are working with Elm Cogen, you see expression. That's the one you're working
[00:55:18]
on is that top level interface. The thing that was making my brain go nuts is you could have
[00:55:25]
expression and then you have a type variable next to it, which is basically the thing you want to
[00:55:30]
generate. Now, the cool part about it is you don't actually need that thing. This is a phantom type.
[00:55:35]
So you could say, or float, you say Elm.float produces an expression of float. Hey, that's cool.
[00:55:42]
And you could definitely create a function that is like add float. Of course, it'd have to be float,
[00:55:46]
which is kind of irritating. Numbers are weird, but let's say there's not a difference between
[00:55:50]
the images and float. So you have add and it takes an expression float, another expression float,
[00:55:56]
and returns an expression float. And then if you didn't pass it, if you pass it like an expression
[00:56:02]
list of float or whatever, you'd get a compile time error. It'd say like, well, you know,
[00:56:08]
I, and it would be like, you know, in that developer catnip kind of a way, like kind of
[00:56:14]
mirroring the original error of like, you know, this function takes a float and float and you gave
[00:56:20]
me a float and you know, whatever. What the heck? So I was like, oh my God, this is nuts. This is so
[00:56:25]
cool. And so I was thinking about it and I was like, okay. And I was like, you know, dreaming
[00:56:29]
about this, having nightmares about it, whatever. You should stop sleeping, man.
[00:56:35]
Oh no, that's not the answer. Type safety for convenience. You go the other way. We got more
[00:56:44]
sleep. More nightmares.
[00:56:49]
So I was thinking about it and like, okay, well, where does this get weird? One part where it gets
[00:56:53]
weird is records. How do you make kind of records work? So records, you need a, you can no longer
[00:57:00]
have a record to create a record. You like to create a record in Lmcogen, you have a list of
[00:57:05]
fields, which is basically the name of the field and the value. That's a problem. It's not totally,
[00:57:13]
so like, again, we're a sliding scale of safety here. Like, and we're comfortable with that. We
[00:57:18]
are not like, so it's like, we kind of give up that like, oh, if it type checks, it generates
[00:57:23]
type checked code. We know that that's probably not doable without some shenanigans or maybe not
[00:57:31]
doable at all. I don't know. Why is that a problem? Is it because you're passing a list of?
[00:57:39]
Yeah, so it's the list part. So the list has to be all one value. So it's like, let's say I wanted
[00:57:43]
a record and it had two fields. One that is my integer and it's an expression integer. And another
[00:57:49]
one, which is my float, which is expression float. All of a sudden that doesn't unify.
[00:57:54]
I think we should clarify too. Like, I think if you're talking about the sort of generated
[00:57:59]
stubs that you have for like, for known APIs, for Lmcogen install some package.
[00:58:05]
That would.
[00:58:06]
You could do that because you could have manually put the phantom type in there. But if you're
[00:58:12]
saying, well, I just want to create my own record, it's not from any package or anything. It's just
[00:58:17]
arbitrary types. Now, like in order to get that phantom type to be a specific thing, you have to
[00:58:26]
pass it in something of that type, but you're not, you're passing it a list, not a record.
[00:58:32]
I think you could potentially do it with a builder pattern.
[00:58:37]
Oh yeah.
[00:58:38]
Yeah. So here's where.
[00:58:39]
Interesting.
[00:58:41]
But you wouldn't be able to get the field name into the type name.
[00:58:45]
So, and you couldn't, you couldn't. So the thing that I think you'd have to do even on the builder
[00:58:52]
pattern is I think you have to have a type hole, which is essentially where an escape hatch for
[00:58:58]
the types. So what this would mean, and this is why originally to add a field to a record,
[00:59:03]
it wasn't just a tuple of like a string and an expression. It was actually I have to say like
[00:59:08]
elm.field passes a string and an expression. The reason why is it would convert it to
[00:59:13]
a special expression, which is expression field. And then you could have a list of those.
[00:59:20]
And you could actually make it work out because you're basically saying, I'm going to throw away
[00:59:25]
the type information here. And you're going to let me do anything. I think you'd have to do the
[00:59:31]
same thing with a builder pattern.
[00:59:32]
Right. Because unless you generated a function for every possible field name, you couldn't get
[00:59:39]
the field names in that type variable.
[00:59:43]
That's right. And so it's like, okay, so I was like, okay, we have this, we have an approach.
[00:59:49]
We can do the field, we can have a little type hole, that's fine. It's not a big deal. It's like,
[00:59:52]
again, it should be more safe and potentially like kind of ergonomic or whatever. And then I realized
[00:59:59]
there was another thing that basically I was just like, well, dang, I don't think that we can do
[01:00:07]
this, which is in the most abstract case, you're not going to know what types you're generating.
[01:00:13]
Like if you want to generate a value of a type that you don't know of until generation time,
[01:00:18]
things get weird.
[01:00:19]
Do you have examples for that?
[01:00:22]
So like, let's say I want to generate like a, where it's like, I don't know the shape of the type
[01:00:28]
and the name of the type or anything. Like so even as it doesn't have to be very complicated,
[01:00:33]
it could be like generating a message type or something. I would all of a sudden have to sort of
[01:00:38]
start to, what I would have to do is I would have to start to mirror, I'd have to create a phantom
[01:00:44]
value, like, okay, here, like I'm generating a message like type. And on the generation code,
[01:00:52]
I'm going to create a type message equal, like type generated message equals generated message.
[01:00:57]
And I'm going to stub that in as the phantom thing for here so that it, but then
[01:01:02]
it just leads down this area where that level of abstraction, you have to start mirroring stuff
[01:01:08]
that you're going to be generating. And I think ultimately you can't because you don't know what
[01:01:14]
you're going to be generating until you generate it, which means you would have to actually maybe
[01:01:18]
generate those types first. And then it's like, where, like, if you're lost, I'm definitely lost.
[01:01:26]
Like if you're like having like, well, I'm not even following you. It's like, great,
[01:01:30]
then we're on the same page. And so then I'm like, oh, but you know, ultimately, and this is where I
[01:01:39]
would like, again, if we were to nail the top, top line thing, can we leverage safety for convenience?
[01:01:48]
And at this point, it started to become clear to me that that was a bridge too far and that there
[01:01:53]
may be options for some safety, but we would give up some expressiveness. And we would also
[01:01:59]
adopt a bucket of confusion. So like an example being like, if someone's coming to Elm, like,
[01:02:06]
you know, we should think of the questions that people generally ask when they come to Elm. One of
[01:02:10]
them, what is a decoder? What the heck? Like, what the heck? Second one, what is this little
[01:02:15]
message on HTML? Right? I mean, those are fair questions. Like, like those are, they're not dumb.
[01:02:23]
Like, they're just they're the first ones you should run into. And so it's like, okay, well,
[01:02:27]
do I want do I want this library to be where it's like, oh, this is for Elm. If you're familiar with
[01:02:33]
this in advance library, it is an advanced library, just because code generation, I think,
[01:02:37]
has to be kind of but like, if, if there's a chance that somebody that this could be their
[01:02:42]
first intro to Elm, and they would actually do something that they maybe in another language,
[01:02:47]
it was too complicated for if they do that, that's such a cool experience. That's so so so cool.
[01:02:52]
And I wasn't, I wasn't willing to have a type variable, screw that up. I'm in favor of type
[01:02:58]
variables in general, just so it's clear. But like, if I don't have to have one, I prefer not to.
[01:03:03]
Yeah, my first experience with Elm was basically building a linter. So playing with ASTs.
[01:03:09]
I think honestly, mine was parsers, right? Which are worse. Yeah. Yeah, but it was solving a big
[01:03:17]
problem. Like I was trying to parse guitar tablature back in the day. And this is actually in
[01:03:22]
lering Haskell. So it was actually if I would have known Elm at that point, or like the Elm
[01:03:26]
parsing library, if it would have existed, that would have been amazing. But this was that was
[01:03:29]
definitely where I was like, Oh, I'm hooked. This is amazing. I had this big bag of regular
[01:03:33]
expressions before, but this is like, so so good. So people can have deep technical experiences.
[01:03:39]
And if we can facilitate them, there's a there's a huge opportunity for people to be like, Oh,
[01:03:44]
that's that was so good. Why? It is that trade off we talked about a lot with like, when you add this
[01:03:50]
guarantee, like, if you do non empty string, is it really gonna like protect you that much? It's
[01:03:58]
like, pretty cumbersome. And it's adding like, or like the Elm HTML escape hatches for different
[01:04:05]
HTML node types. It's like, well, take that what if you what if you write an HTML node type that's
[01:04:12]
not a valid HTML nodes? What if you write empty string for the HTML node type? Well, okay, but
[01:04:19]
at least you know, if you use the core functions, if you use html.div html.span, you're going to be
[01:04:25]
fine. And if you use node, just don't pass it an empty string is probably okay. Yeah, I think
[01:04:31]
there's there's this thing of like, you think about the appetite people have for various things.
[01:04:35]
I'm not sure that people come into Elm with a huge appetite for safety.
[01:04:40]
I think they come into it for a big appetite for sanity, like clarity. I would say that's probably
[01:04:47]
the more the thing and then like you sort of think about it afterwards, like, oh, yeah, no
[01:04:51]
runtime errors. You don't think about no run runtime errors is like a thing that's desirable
[01:04:55]
until like you're in the pit of despair, like experiencing errors all the time. But like, it's
[01:04:59]
not the thing you strive for. Ultimately, like the thing is like you strive for I want to build this
[01:05:04]
beautiful thing or like, look at this cool code. I was able to make this and it's like, I'm not
[01:05:09]
able to make this and it I'm able to do what I could not do before. And it makes sense to me.
[01:05:15]
I didn't like go nuts. And in this case, ultimately, like you still have the Elm compiler to check for
[01:05:22]
things. So yeah, I think dropping the type variable to try and type check things makes a lot
[01:05:30]
of sense. Nice. Yeah, it was it was definitely painting me for a while. But like more and more
[01:05:37]
well, not more and more these days. I want to thread the needle on safety in service of
[01:05:44]
convenience. Right? Yeah, I like the balance you've struck. I wanted to touch on also like,
[01:05:50]
you you provide an API for for creating the generate programs that sort of run your generation
[01:05:58]
code. So like the default one, you just generate a list of modules. So you give it modules which
[01:06:06]
have declarations which have expressions in them and use all this Elm code gen goodness to
[01:06:12]
kind of safely generate files and it and it outputs files when you run Elm code gen run.
[01:06:17]
But then you've got some some ways to create a program that has flags. So like you've got
[01:06:24]
from JSON, which you give it a JSON decoder, and then you get access to those flags for
[01:06:30]
generating your program. So tell us a little bit about those kind of helpers. Sure.
[01:06:34]
Yeah, so in the Elm code gen, the CLI, the thing that runs stuff, the CLI, there's some JavaScript,
[01:06:41]
which is actually very simple. If you want to run an Elm app using node, if that interests you,
[01:06:48]
it's surprisingly simple. It's basically like, start this Elm application. If you have ports,
[01:06:53]
maybe you talk to it by ports. But so behind the scenes, Elm code gen is just, you know, starting
[01:07:00]
your own application and sort of it has two ports, which is basically I think there's a success and
[01:07:05]
a failure port probably could have been like one of them. But and it's expecting a certain shape of
[01:07:11]
JSON in both sides. And you're also able to pass data through the flags. So what I found in most
[01:07:18]
cases, the thing that you're the most common case that you're doing is taking some external source
[01:07:25]
of data and you want to do something with it. So you may like the most convenient way to do that
[01:07:30]
is like I'm going to make an API call and get some JSON and then I'm going to hand that JSON to
[01:07:36]
Elm code gen and it's going to do a thing. So I wanted to make that like just super, super convenient.
[01:07:42]
So like in the Elm code gen CLI, you can basically just say like Elm code gen space run space flags,
[01:07:50]
and then you hand it a JSON file and it will read that. And then you'll have to have a decoder on
[01:07:57]
your decoder side. But and then you can kind of do whatever. And then there is also some stuff
[01:08:05]
to be able to where it's like maybe the more advanced cases you kind of want this where it's
[01:08:09]
like maybe you want to be able to throw it. Well, you definitely want to be able to throw errors,
[01:08:13]
right? Like, like, well, you know, figma changed their API, like in this value is not whatever.
[01:08:19]
Or in some cases, I believe there's an affordance for it, like just talking to the terminal saying
[01:08:25]
like, here's a warning, here's whatever. So it was really just trying to make find what are those
[01:08:30]
really convenient things and, and just make them convenient. So the most most convenient one was
[01:08:37]
JSON data. If it's not, if it doesn't have the JSON suffix, it'll just pass it in as a text file.
[01:08:43]
So markdown, great, you'll get a markdown file, like, you can do whatever. I think there's probably
[01:08:49]
some additional stuff we can do there. Sources of truth that are interesting is like, like, I know
[01:08:54]
Ryan with elm land, which is a very cool projects, was looking at just your directory structure of
[01:09:01]
your page, and using that to drive your routes. I think that's that's super insightful, right?
[01:09:06]
That means the source of truth is the is the directory structure. And there's, there's no like,
[01:09:10]
a built in way to grab that in elm code gen. But it's really not hard to just wrap that in JSON
[01:09:16]
and shove it in the code gen. Right. So, so for instance, if you were if you wanted to have access
[01:09:21]
to the contents of an elm file, for instance, then you would pass that as a flag. And then you just
[01:09:27]
have one giant string. And if you wanted to have access to two elm files, then you would convert
[01:09:35]
them to some JSON and possibly Yeah, okay. I think there's probably a few different ways to slice it
[01:09:40]
like depending on it's hard to basically say, Oh, here's the way without seeing a specific project,
[01:09:46]
right? As far as what are the best ways to do that, it could be where it's all loaded in through
[01:09:51]
flags, maybe there's like a crazy async thing you have going where it's your you can still talk to
[01:09:57]
this thing via ports, right? It's the actor pattern. So you could, you could have a thing
[01:10:01]
where you're like feeding it files as you go, but you'd need to adjust the elm code gen utility. And
[01:10:07]
like, like right now that for elm GQL, to be clear, because elm code gen didn't have its own
[01:10:12]
way of running stuff, elm GQL, just because that JavaScript is not that hard to write,
[01:10:17]
just wrote its own JavaScript runner. Right. And so like, and can basically do whatever it has its
[01:10:23]
own CLI interface, like the intention with elm GQL is that it's its own thing. So I don't want like,
[01:10:29]
I don't want someone to start up elm GQL and have it say like, welcome to elm code gen,
[01:10:34]
would you like to call elm HTML and they're being like, what the heck are you talking about?
[01:10:40]
So like, I think what if people are looking to build tools on top of elm code gen, which,
[01:10:46]
by the way, if you are, I'm super excited to hear about it. And if you run into issues,
[01:10:50]
especially right, and if you don't run into issues even better, but probably what I'd recommend if
[01:10:56]
you're looking into it is like, can you even copy elm code gen CLI as a starting point and adjust it
[01:11:04]
as maybe you have different flags or like whatever, you know, but do what like, do what fits for your
[01:11:09]
projects and use elm code gen CLI as a reference for what, how to talk to stuff, but be pretty easy
[01:11:17]
to extend it. I'm actually really thinking about like, it would be cool if there was like an elm
[01:11:23]
pages harness. So like, you know, elm pages is for like building static sites and with v3 for
[01:11:30]
building sort of server rendered sites. But the heart of elm pages is this data source abstraction,
[01:11:37]
which is basically a way of like, asking node JS to do things for you. Make an HTTP request and
[01:11:44]
give me that data. Read this file, decode this file as JSON, whatever, right. So glob, glob a
[01:11:51]
list of file paths and get me that as the input, right. So it's communicating with node JS to like
[01:11:57]
do nodey things and then give you back elm data in a safe way, right. So, and then you can map that
[01:12:03]
into whatever. It would be really cool if you could like do, you know, data source HTTP dot get,
[01:12:10]
get some JSON data, decode that, generate some code with just elm code gen types, and then you're
[01:12:18]
up and running. And if that was like a little self encapsulated command line tool, that'd be so, so
[01:12:23]
useful. I would use that.
[01:12:27]
Yeah, I think I think there might be an opportunity for elm code gen basically as the library, right?
[01:12:31]
Like, right. And like, if you're already doing interesting things with, you know, data sources
[01:12:36]
and threading through stuff, and I mean, you're already generating files, right? Like, so this is
[01:12:41]
just like, exactly, like, you wouldn't even need to. Yeah, you just like, put elm code gen in
[01:12:47]
wherever you want to generate some stuff. I mean, ultimately, the vast majority of elm code gen is
[01:12:52]
just in elm. You can run it in an le, right? Like, I really like that you can run it. You can
[01:12:59]
transform the generated code to string, and therefore making it available to elm review,
[01:13:04]
which people can do cool things with it. Like, oh, yeah, there we go.
[01:13:12]
If your review is you're generating elm code before it's generated, is that useful? Probably not.
[01:13:20]
No, well, Martin Seward and even Dillon wrote some review rules where you did say debug.to do,
[01:13:27]
and in this ring, you have HTML code, and that transforms it to HTML or JSON decoders or
[01:13:35]
whatever. Okay.
[01:13:36]
So there's definitely some uses for it. I don't know if it's easier to write it using strings,
[01:13:43]
but maybe elm code gen would be perfect here. It would be very cool. Let's make elm pages code
[01:13:49]
gen review and then call it a day. Let's do it. Perfect.
[01:13:56]
Yeah, I actually used elm code gen like a while back for something when it was still elm prefab.
[01:14:03]
That was the original name. Yeah, I forgot about that.
[01:14:07]
I also own elmprefab.com.
[01:14:12]
It was pretty fabulous as advertised. The one thing that I ran into, which is not your fault,
[01:14:20]
but it's an unfortunate limitation, is that I accept all responsibility.
[01:14:24]
Well, yeah, if you want to, you can't put inline comments in expressions.
[01:14:29]
That's right.
[01:14:30]
Yeah, I was trying to use it for a couple of things where I wanted to do for elm HTTP fusion,
[01:14:37]
this app that Mario and I have collaborated on a bit, mostly Mario, but to kind of scaffold out
[01:14:44]
these decoders and stuff based on JSON responses. But the scaffolded code, sometimes you want to put
[01:14:51]
in these little comments in the scaffold code and that's a limitation.
[01:14:56]
Yeah, I definitely want it.
[01:14:58]
I'm guessing it's a limitation from elm syntax or something.
[01:15:01]
That's right. That's right. So you can have comments, top level comments.
[01:15:06]
You can have doc comments attached to declarations, right? So those are supported
[01:15:11]
and should be great. The challenge, this elm code gen is built on top of a library called elm syntax.
[01:15:17]
And what elm syntax does when it parses elm code, even though we're not necessarily parsing elm code
[01:15:22]
in elm code gen, except sometimes, is that it takes all the inline comments,
[01:15:29]
notes their source position, so their column and line, and then it drags them up to a
[01:15:35]
dictionary or not dictionary, a list at the top of the data structure. So it takes them out of the
[01:15:40]
AST. And generally, you know, I mean, there's a topic of discussion for like, do comments live in
[01:15:46]
ASTs? I think ultimately, it depends what your purpose of your AST is. Elm syntax, it's a
[01:15:52]
question that's interesting to ask, what is the purpose of elm syntax? I almost think that it
[01:15:57]
makes sense to actually keep the comments in the AST, even like in a way where it's not, doesn't
[01:16:03]
invalidate your thing. But that's the right now, I don't really want to get into like, well, it
[01:16:09]
would be a huge lift for elm code gen to figure out the math of where the comments go, because elm
[01:16:15]
code gen essentially doesn't care about source position, because it's not reading a file, we're
[01:16:21]
using like, we're so like all the source positions and elm code gen behind the scenes are like zero,
[01:16:26]
zero. So it'd be like, oh, no, now we have to like do this math. And if I if I screw up, then,
[01:16:33]
then, you know, your code code is going to be broken. So I was like, okay, well, I'm just going
[01:16:37]
to wait for some smart person to figure it out in elm syntax. And no, no, because I'm the one with
[01:16:44]
published rights on the package. I know. And I have no clue how to do it. Like, I've actually
[01:16:51]
looked at what different ASTs did in JavaScript. And it was, I found like 20, which was a
[01:16:57]
surprisingly large number. And all of them either ignored comments or put them in a list, just like
[01:17:05]
elm syntax does. And one of them put them in the AST. But then there's a question like, is this
[01:17:11]
is this AST node, the right one to attach the comment to? Do you want to put the comments before
[01:17:17]
or after? That's also...
[01:17:19]
That's what you would have is you'd have well, shooting from the hip here, like, and I don't
[01:17:26]
expect this to be fair, I have no intention of putting this on your plate. But like what I would
[01:17:32]
expect is you'd have two constructors, one for comment before one for comment after. And, and it
[01:17:39]
is sort of like a function in that it's sort of like has to be attached to another expression. You
[01:17:44]
can't have a comment just, you know, hanging out by itself. But...
[01:17:48]
Well, except if it's at top level.
[01:17:51]
Right. Well, track those separately, right? Maybe have a different flavor of top level comment.
[01:17:55]
But I know that's Elm format also has a lot of complexity around comments.
[01:18:01]
It's tricky. It's a tricky situation. And like, it's one of those things where it's like the use
[01:18:05]
case in this case is super clear. It's very clear in other cases that comments, it would be great to
[01:18:13]
just get rid of them. So like for compile, like if you ever look at the Elm compiler, it's like,
[01:18:17]
it makes sense that it's not tracked there. Like formatting, it does make sense. It's a whole thing.
[01:18:22]
And that's why I say when I like talk about ASTs being weird, there's also like varying levels of
[01:18:27]
information depending on what you're actually trying to do with a given AST. And if it's there,
[01:18:32]
it's great. If it's not, it's challenging. And it's hard to possibly add in stuff later.
[01:18:37]
Yeah. Yeah. But aside from that limitation, like it really seems like, you know, I mean,
[01:18:43]
you can run the type checking yourself anytime you want to after you generate something. And
[01:18:48]
otherwise, it's just a lovely tool. So thank you for introducing it to the community.
[01:18:54]
Yeah, that's wonderful. I'm very excited for it to be out.
[01:18:58]
I'm looking forward to what people make with it.
[01:19:02]
Yeah, exactly. Me too. Yeah, amazing stuff. What should people look at if they if they want to get started?
[01:19:08]
Yeah, so the main thing to check out is going to be the GitHub repo, which is just mdgriffith slash elmcogen.
[01:19:16]
There's also a post on the discourse, the Elm discourse of that sort of gives maybe a more involved motivation.
[01:19:26]
But I think most of that's captured in the readme. There should be like, just a few examples there to naturally like get started with.
[01:19:34]
I probably need to add more. There are guides on that repo that sort of lead you through the various like inception levels of code generation, starting out concrete and moving to more abstract.
[01:19:49]
I think to get started, I think it's really useful, or it's pretty fun to actually just mess around with an Ellie.
[01:19:55]
And just install it and just get a feel for it. I should probably have that set up on the readme as far as like to really get people started.
[01:20:04]
But and then once you kind of get a little bit of the flavor of it, it can be probably the next step is setting up a project and deciding what is your source of truth and what do you want to generate?
[01:20:17]
Those are the two big decisions, honestly.
[01:20:20]
Yeah, or npm install elm codegen review pages and coming soon.
[01:20:28]
Yeah. Yeah. Amazing. And we'll look out for your Strangeloop talk as well. Super excited.
[01:20:34]
Thank you. Yeah, it's gonna be good.
[01:20:36]
Amazing stuff. All right. Thank you so much for joining, Matt. It was a pleasure.
[01:20:39]
Yeah, thank you.
[01:20:41]
And Jeroen. Until next time.
[01:20:43]
Until next time.