spotifyovercastrssapple-podcasts

Elm and AI

Can we get strong guarantees from AI tools that are known to hallucinate? We discuss some strategies, and ways that Elm might be a great target for AI assistance.
April 11, 2023
#80

Transcript

[00:00:00]
Hello Jeroen.
[00:00:01]
Hello Dillon.
[00:00:02]
I'm very glad to be talking about this topic so promptly.
[00:00:06]
I think it's really important to get on it and talk about it right away.
[00:00:10]
I was thinking you were going to do a pun with AI or something and I was like, I couldn't
[00:00:16]
find anything to, anything funny to say, but yep.
[00:00:21]
Good one.
[00:00:22]
Good one.
[00:00:23]
Yeah, it was unprompted, but I had to go for it.
[00:00:26]
This was a handcrafted artisanal pun, not coded, not AI assisted in any way, I promise.
[00:00:33]
I believe you.
[00:00:34]
Not, not on the unprompted part.
[00:00:36]
It actually was not AI assisted, although, um, we're going to, I imagine we're going
[00:00:40]
to have a lot of bad puns out there these days with AI assisting people, you know, using
[00:00:46]
it for evil and creating more puns in the world.
[00:00:48]
So be on the lookout.
[00:00:52]
Well that will compensate the fact that people have less kids nowadays and there are less
[00:00:56]
dads, you know, so I think we've introduced the subject.
[00:01:03]
We're going to talk about AI and Elm and all of those things that are quite buzzy at the,
[00:01:11]
in the last few months.
[00:01:14]
And ever more and more, it's a bit hard to keep up.
[00:01:19]
It's going so fast.
[00:01:20]
So just to set the record or we're recording at the beginning of April, 2022, 2023.
[00:01:31]
No you are wrong.
[00:01:32]
If we were recording this in 2022 and talking about GPT-4, that would be incredibly prescient.
[00:01:40]
Yeah, but I'm just going to gaslight you and tell you you're wrong.
[00:01:45]
Just like that AI.
[00:01:46]
It's a hallucination.
[00:01:47]
Are you hallucinating?
[00:01:48]
Are you an AI?
[00:01:49]
I am legally contracted to say no to that.
[00:01:54]
So yeah, so this is April, 2023.
[00:01:58]
In one month, this will be outdated.
[00:02:00]
We hope it won't, but we'll see.
[00:02:02]
So chat GPT-4 was just released.
[00:02:06]
GitHub Copilot X was announced.
[00:02:08]
Yeah, I'm on the waiting list for that.
[00:02:10]
Haven't gotten access yet.
[00:02:11]
So yeah, this is the current state.
[00:02:14]
AI journey is the best one to create images so far, and we have no clue how it will be
[00:02:20]
in the future.
[00:02:21]
Things are moving very fast.
[00:02:23]
Yeah, very fast.
[00:02:25]
So these are all very interesting technologies and people think that they are going to revolutionize
[00:02:32]
a lot of things.
[00:02:33]
They're probably going to be right in some aspects and wrong in some others.
[00:02:38]
What I want to talk mostly today about was like the coding aspects of it.
[00:02:42]
Is AI going to replace developers?
[00:02:45]
Is it going to help them mostly?
[00:02:48]
And all those kinds of things that people might wonder as well.
[00:02:52]
How do you use this effectively to your advantage?
[00:02:56]
How do you avoid being misusing them as well?
[00:03:00]
So you've played with chat GPT-4 at the moment, and I think you've had some interesting results.
[00:03:07]
Yes.
[00:03:08]
Do you want to talk about that?
[00:03:09]
Yeah.
[00:03:10]
So maybe to set the stage a little bit regarding the question of will AI take our jobs?
[00:03:16]
I tend to think that, I mean, of course, it's very interesting and time will tell and anything
[00:03:22]
could happen.
[00:03:23]
Things are moving very quickly.
[00:03:24]
I don't think we can make predictions with too much accuracy at this stage with the way
[00:03:30]
things are going.
[00:03:31]
But I tend to believe that this is going to be a very powerful tool.
[00:03:35]
And I think that it's more likely that people who are good at using these tools will replace
[00:03:42]
your job rather than the tools themselves will replace our jobs.
[00:03:47]
So I think it's an important skill, just like Googling was an important skill.
[00:03:52]
Of course, it's a next level of that.
[00:03:56]
It's more sophisticated.
[00:03:57]
It's able to do things on its own, which is not quite what Google was doing for us.
[00:04:04]
But you can be...
[00:04:06]
Googling is an important technical skill.
[00:04:08]
And if you are a developer, it's worth trying to get good at that.
[00:04:13]
And in the same way, I think using AI tools effectively is an important skill.
[00:04:19]
Similar to using an ID effectively, for instance, instead of writing everything in notepad or
[00:04:25]
on literal punch cards or...
[00:04:27]
Well, now I'm going too far, but...
[00:04:30]
Well yeah, exactly.
[00:04:31]
And we have to keep up with the technology.
[00:04:33]
So I would say that maybe I'm an optimist, but I would say keep up with the latest technology
[00:04:39]
to stay relevant.
[00:04:41]
But hopefully we're going to be able to do more sophisticated things leveraging these
[00:04:45]
tools.
[00:04:46]
Now, another sort of piece of background I want to introduce to this conversation is
[00:04:51]
to me, this is a really big question.
[00:04:54]
Is Elm and pure typed functional programming a good combination with AI?
[00:05:01]
Do you have an opinion on that?
[00:05:02]
Well, it could be a good one or it could be an irrelevant one in the sense that if an
[00:05:09]
AI writes all the code for you, and it's awesome at it, like much better than you could be,
[00:05:15]
like, let's say a hundred times better than you, then why do you need type safety?
[00:05:20]
Why do you need ease of refactoring and a language that is easy to maintain?
[00:05:27]
Maybe you don't.
[00:05:28]
I personally don't believe that that will happen.
[00:05:32]
I'll talk about that later.
[00:05:33]
Probably.
[00:05:34]
I think it's actually better to have a, at least a typed language like Elm to work with
[00:05:40]
because at least so far in April, 2020 something, chatGPT and all those tools, they give you
[00:05:54]
incorrect results.
[00:05:56]
They're very impressive and they're often correct, but they're also more often than
[00:06:02]
not, I'd say incorrect or slightly inaccurate or in the case of Elm, often it has in syntax
[00:06:09]
errors.
[00:06:10]
Right.
[00:06:11]
And you want to know about those, right?
[00:06:13]
Yeah, exactly.
[00:06:14]
And one thing that Elm gives us is a nice compiler with a great type checker and some
[00:06:20]
additional linting that it does on its own.
[00:06:23]
And that helps prevent a lot of issues that humans make, but that an AI can do as well
[00:06:29]
because those AIs have been trained on humans and Slack overflow.
[00:06:34]
Probably not on the Elm Slack, by the way, which would be a great resource.
[00:06:38]
Interesting.
[00:06:39]
Yeah, that's true.
[00:06:40]
I've noticed a lot of like old syntax, like the prime syntax, the little apostrophe it
[00:06:47]
likes to use.
[00:06:49]
But I also think it's been trained on Haskell code.
[00:06:52]
Yeah, totally.
[00:06:53]
In some cases.
[00:06:54]
Totally.
[00:06:55]
I really like your framing.
[00:06:57]
I think that's spot on for, you know, is typed pure functional programming a good fit for
[00:07:06]
these AI tools?
[00:07:07]
And I think this is exactly the right question.
[00:07:10]
Are humans going to be maintaining it or are machines going to completely just take over
[00:07:16]
the code and humans don't need to be involved?
[00:07:18]
I think that's exactly the right question.
[00:07:20]
I think that my gut feeling is right now for the next little while, at least, we've still
[00:07:29]
got a little time where we're going to be an important part of the process.
[00:07:33]
And I see it more as a collaboration between humans and AI at the point where the humans
[00:07:40]
are no longer needed.
[00:07:41]
Then, yes, the whole pure typed functional programming thing doesn't matter so much because
[00:07:46]
it's an implementation detail at that point.
[00:07:48]
But until then, I think it's extremely valuable because, as you say, it's very prone to hallucinations.
[00:07:54]
So like...
[00:07:55]
Hallucination being when it says something and it thinks it's right.
[00:08:01]
Exactly.
[00:08:02]
And when it isn't, when it isn't.
[00:08:03]
Yes, because these... and hallucination is like sort of the technical term that open
[00:08:09]
AI is using in some of these white papers talking about this and stuff nowadays.
[00:08:14]
But hallucination, it's very prone to hallucination because these are sort of predictive models
[00:08:20]
that kind of synthesize information, but it's not an exact science.
[00:08:26]
And sometimes it mixes things together that don't quite fit.
[00:08:30]
And so I think, I mean, Jeroen, I think it's fair to say that we really like having tools
[00:08:36]
that we can trust.
[00:08:37]
If there's one thing you can say about us as the hosts of Elm Radio, I think that's
[00:08:44]
a fair thing to say, right?
[00:08:46]
Yeah, yeah.
[00:08:48]
We do not accept half guarantees, right?
[00:08:52]
We like guarantees.
[00:08:53]
We like constraints.
[00:08:54]
We like guarantees.
[00:08:55]
Yeah, otherwise we wouldn't use side trips.
[00:08:57]
Right, exactly.
[00:08:59]
Then we get like pretty good... you can't really call it a guarantee if it's pretty
[00:09:03]
good, right?
[00:09:04]
Guarantees are not pretty good.
[00:09:05]
Guarantees are guarantees.
[00:09:06]
You get pretty good assurances, pretty good confidence, but you don't get guarantees.
[00:09:12]
We like guarantees, right?
[00:09:13]
Yeah.
[00:09:14]
Well, I guess to some extent Elm is also improvable in that way.
[00:09:18]
Like we're not doing formal logic or proofs.
[00:09:22]
Fair.
[00:09:23]
We're pretty close to that.
[00:09:25]
Yeah.
[00:09:26]
Especially considering how simple the language is and how usable.
[00:09:30]
And the things that you can know about an Elm program, you do know.
[00:09:35]
So like we don't get guarantees about everything, but we do get certain things for which they
[00:09:41]
are definitely guarantees.
[00:09:42]
And we like that.
[00:09:43]
And we try to get more of those things.
[00:09:45]
I know somebody who built a whole tool to try to get more guarantees through static
[00:09:50]
analysis for Elm code.
[00:09:52]
So people go to great lengths for these things, I hear.
[00:09:57]
So then when you're talking about guarantees and then AI that's prone to hallucination,
[00:10:03]
that becomes an interesting question, right?
[00:10:05]
Now I actually am pretty confident about our ability to do useful things with that.
[00:10:12]
Maybe that's counterintuitive because I'm talking about how much we care about guarantees
[00:10:18]
and then talking about hallucination.
[00:10:20]
I'm actually very reluctant to integrate things like GitHub copilot suggestions into my code
[00:10:27]
because I think it's a very easy way to introduce subtle bugs.
[00:10:32]
But the way I'm thinking about how AI fits into my workflow for writing Elm code and
[00:10:39]
my sort of ideals for tools that involve like trusting my tools so that I can do critical
[00:10:48]
thinking and then delegate certain types of problems with complete trust to a tool, right?
[00:10:55]
Those two things do fit together, but not out of the box.
[00:10:59]
If you just throw in whatever suggestions GitHub copilot is throwing at you, like for
[00:11:04]
example, I was playing around with GitHub copilot, which for anyone who hasn't used
[00:11:08]
it, it's now a paid tool, but it will give you sort of fancy AI assisted, GPT assisted
[00:11:17]
auto completions in your editor.
[00:11:19]
I think it's free for open source maintainers.
[00:11:22]
With a certain number of stars.
[00:11:24]
Unfortunately, I didn't qualify.
[00:11:26]
Really?
[00:11:27]
I think I qualified.
[00:11:28]
Or maybe I'm using the free version still.
[00:11:31]
Yeah, you might have been using the open beta.
[00:11:33]
I got it for free in the beta period, but you probably need like 10,000 stars or something.
[00:11:40]
I don't know.
[00:11:41]
Not many.
[00:11:42]
Hey, people, we need stars.
[00:11:45]
Get on it.
[00:11:46]
Otherwise, we need to pay for like $10 a month or something, which is unacceptable.
[00:11:52]
Yeah, our listeners can pay us in stars.
[00:11:54]
Go star a project right now.
[00:11:56]
Pause this podcast and star our projects.
[00:11:59]
Yeah.
[00:12:00]
So it's definitely interesting working with Copilot.
[00:12:03]
I have to say, I don't find it.
[00:12:06]
In some cases, I'll trust it.
[00:12:08]
I will have a custom type with four variants, and I will write out a function that says
[00:12:15]
my custom type to string, and then it fills it in perfectly.
[00:12:19]
And it's impressive, but there are certain things like that, that I have an intuition
[00:12:27]
that it's going to be really good and trustworthy at solving.
[00:12:30]
That said, it does hallucinate certain things.
[00:12:32]
It will hallucinate certain variants because the process through which it is arriving at
[00:12:37]
these suggestions does not involve understanding the types of the program like the compiler
[00:12:43]
does.
[00:12:45]
So to me, where it gets very interesting is when you start using prompt engineering to
[00:12:51]
do that.
[00:12:52]
And so I've been thinking about a set of principles around this.
[00:12:59]
So prompt engineering is when you ask a question to get a Copilot or mostly chatGPT or other
[00:13:07]
tools and you do it in a specific way, like you frame your questions in a specific way,
[00:13:12]
you ask for specific things, you give additional instructions so that it gives you better results.
[00:13:18]
I don't know why people call it engineering yet, but it's very interesting.
[00:13:24]
Although, I mean, there are prompt engineer job posts out there, and I think this is kind
[00:13:30]
of going to become a thing.
[00:13:32]
So it feels more like politics, like when you try to phrase things that sound good to
[00:13:38]
you, what makes you sound good.
[00:13:41]
It's more like a speech thing than an engineering thing so far.
[00:13:45]
Absolutely.
[00:13:46]
Absolutely.
[00:13:47]
I hope those literature majors in college are finally cashing in on those writing skills.
[00:13:53]
Oh, now you're not making fun of my poetry degree, right?
[00:13:58]
Now that I can make full blown web applications in two seconds.
[00:14:03]
Right.
[00:14:04]
Yeah, I mean, I think writing skills have been valuable for a long time, but this unlocks
[00:14:11]
a whole new set of things you can do, including engineering with your writing.
[00:14:15]
And it really is like, I mean, if you think about what these prompts are doing, like the
[00:14:20]
way that they work is they're based on the context they're given, they're sort of like
[00:14:26]
role playing with that context, essentially, because their basic premise is given like
[00:14:33]
this context, what's likely to follow it, right?
[00:14:36]
So if you write in a certain style, it is going to be more likely to follow with a certain
[00:14:42]
style.
[00:14:43]
If you write in a style that sounds very much like a scientific paper, a scientific journal
[00:14:48]
publication, and you write about your method for your study and all these things, it's
[00:14:57]
probably going to give you more rigorous results.
[00:15:00]
And it's probably going to do the things that it's seen by gathering information from a
[00:15:06]
bunch of scientific journals, like coming up with a rigorous method and talking about
[00:15:11]
whatever, like counterbalancing, you know, addressing particular concerns and stuff.
[00:15:16]
So like, you have to really get it to role play to solve the problem you want it to solve,
[00:15:22]
to be like the smartest thing to address the problem you want.
[00:15:27]
And that's where nerds come into play again.
[00:15:30]
Yes, totally.
[00:15:32]
Because we kind of get that.
[00:15:34]
It's not just like some magic box to us, like we kind of can understand how it could synthesize
[00:15:40]
information so we need to give it useful context for that.
[00:15:44]
Now I was thinking like, people play Dungeons and Dragons.
[00:15:48]
Oh, that too.
[00:15:49]
Or used to role playing.
[00:15:52]
Yeah, very true.
[00:15:55]
Yeah, so like, I think priming it with good context is one thing that I've been thinking
[00:16:02]
about as I've been playing with it.
[00:16:04]
And another thing I think about is like, is like how verifiable is the problem you're
[00:16:11]
giving it?
[00:16:12]
So if you give it a problem and you're like, I don't know, what is the meaning of life?
[00:16:18]
And it tells you something, it's like, well, how do I verify it?
[00:16:22]
Like I haven't given it much context, I've given it sort of a vague thing, it's going
[00:16:25]
to be piecing together a bunch of things.
[00:16:28]
I'm not like giving it a specific problem to solve.
[00:16:31]
I'm not giving it a problem that I can verify that I've gotten the answer.
[00:16:37]
So if I give it some like an elm problem, and I have a way to check.
[00:16:45]
So like there are certain problems where it's difficult to find an answer, but it's easy
[00:16:52]
to know that the answer is correct once you have it.
[00:16:56]
And P problems.
[00:16:57]
Is that the term?
[00:16:58]
No, but you know, P equals NP.
[00:17:02]
I never quite got that.
[00:17:03]
I'm going to need to ask chat GPT to explain that to me better.
[00:17:07]
Okay, let's not get into that one.
[00:17:11]
That's a few hours of content, which is probably not best served by us.
[00:17:16]
I guess like things like the traveling salesman problem you like would be an example of that,
[00:17:21]
right?
[00:17:22]
And then yeah, that's an NP problem.
[00:17:23]
You can tell if you have a solution and it does fit an optimal path, it's easy to tell,
[00:17:29]
but it's not easy to derive an optimal path, something like that.
[00:17:33]
Yeah, almost.
[00:17:35]
You know whether the solution that is given is a solution because you can check it and
[00:17:39]
the checking is pretty easy.
[00:17:41]
But knowing whether it's optimal is extremely hard.
[00:17:45]
I see.
[00:17:46]
Right, right, right.
[00:17:47]
Okay.
[00:17:48]
So like, is this the most optimal solution?
[00:17:51]
Well, to check that you would need to check all other solutions.
[00:17:55]
And it's easy to if you find a counter example, then yes, you know, it's not the most optimal
[00:18:00]
one, but to know that whether it is indeed the most optimal one, you're going to have
[00:18:05]
to check everything.
[00:18:06]
And that's, that's extremely expensive.
[00:18:08]
Right, exactly.
[00:18:09]
Yeah.
[00:18:10]
So I think like, to me, that's the type of mindset for finding good ways to use these
[00:18:15]
tools to automate our coding.
[00:18:18]
Also like, like you mentioned, finding a counter example in the traveling salesman problem
[00:18:24]
is easy to verify because you just check how many nodes it traverses or whatever, right?
[00:18:30]
And it's, is the number smaller, right?
[00:18:33]
So that's a very cheap operation to test a counter example.
[00:18:38]
So if you know, so, so if you're able to like, get, let's say you try to prompt the, you
[00:18:46]
know, write a prompt engineering prompt for chat GPT to solve the traveling salesman problem
[00:18:52]
for something and you set it up and you prime it with some context and you like, you found
[00:18:58]
one solution, but now it needs to find a better path.
[00:19:03]
And if it, if it gives you a more optimal path, then you're done.
[00:19:07]
You can easily verify that and you can say, you know that it provided you with something
[00:19:13]
valuable because you can easily verify that it's a valid solution and a more optimal solution.
[00:19:20]
Right?
[00:19:21]
So the, there, this class of problems that is easy and cheap to verify that it's valuable
[00:19:29]
is the kind of thing that where I find it to be a very interesting space.
[00:19:34]
And I think that Elm is very well suited to this type of problem.
[00:19:37]
So like one very simple example, like if you, if you want to write a JSON decoder and now
[00:19:46]
another consideration here is like what inputs can we feed it to prime it to give, to give
[00:19:52]
us better results.
[00:19:54]
Right?
[00:19:55]
So that, so we want to give it like prime it with good context and we want to have verifiable
[00:20:02]
output.
[00:20:03]
I've also been thinking about like that verification through a feedback cycle.
[00:20:08]
So iterating on that verification becomes interesting.
[00:20:12]
If you use the open AI APIs, you can automate this process where you can test these results.
[00:20:20]
So you, and then you can even give it information like Elm compiler output or did a JSON decoder
[00:20:26]
succeed.
[00:20:27]
So if you, for example, you're trying to solve the problem of, I want to write a JSON decoder
[00:20:32]
and you either have like a curl command to run to hidden API or some JSON example of
[00:20:39]
what the API gives you, for example, that's your input.
[00:20:43]
You prime it with that.
[00:20:44]
You can even prime it with like a prompt that helps step you through that process to, to
[00:20:51]
give you higher quality output, but then you can verify that.
[00:20:54]
So you say your job is to write a JSON decoder.
[00:20:58]
It needs to decode into this Elm type and it needs at the end, it needs to give me a
[00:21:05]
compiling JSON decoder of this type and it needs to successfully decode given this input.
[00:21:12]
That's all verifiable.
[00:21:14]
So if it gives you garbage or hallucinate something, or it gives you invalid syntax,
[00:21:18]
you can even tell it and it can iterate on that.
[00:21:21]
And you can kind of reduce the amount of noise.
[00:21:24]
Because I don't want to hear about hallucinations from AI.
[00:21:28]
So you know, like before I mentioned like how much we want guarantees, not like somewhat
[00:21:34]
high confidence.
[00:21:35]
I want guarantees.
[00:21:37]
But if we can throw away anything that's garbage and only get signal, no noise, then we can
[00:21:44]
do really interesting things.
[00:21:46]
And Elm is really good for that.
[00:21:48]
You would like to have a system where you skip the intermediate steps of saying, telling,
[00:21:52]
hey, this is wrong, because this doesn't compile.
[00:21:55]
So here's some source code.
[00:21:58]
Here's my request.
[00:21:59]
And then there's some back and forth between the Elm compiler, for instance, and the system,
[00:22:05]
the AI.
[00:22:06]
And then you only get to know the ending result.
[00:22:09]
Exactly.
[00:22:10]
That would be much nicer.
[00:22:11]
And then it's like a proven result.
[00:22:14]
It's a guarantee at that point.
[00:22:15]
So this is kind of the cool thing is like, with a little bit of glue and a little bit
[00:22:22]
of piecing things together, a little bit of allowing it to iterate and get feedback and
[00:22:27]
adapt based on that feedback, which is actually like GPT-4 is very good at this.
[00:22:32]
You can get guarantees, you can get guaranteed safe tools, especially with Elm.
[00:22:36]
With JavaScript, that would be more challenging.
[00:22:38]
Yeah, it would be hard to verify the results.
[00:22:41]
But I'm guessing, or at least whenever you say verifying the results, I'm thinking of
[00:22:46]
the Elm compiler.
[00:22:47]
But I'm also thinking of writing tests, you know.
[00:22:50]
Exactly.
[00:22:51]
I would probably also try to include the results of Elm tests to the prompt, if possible.
[00:22:59]
But that does mean that you need to verify things.
[00:23:03]
And that's kind of what our industry is all about, right?
[00:23:07]
Why we have software engineers and not just coders.
[00:23:11]
That's why we call ourselves engineers, is because we make things and we know it's going
[00:23:18]
to be, we know we shouldn't trust even ourselves.
[00:23:23]
We shouldn't trust the code that we're writing, the code that we're reading, and the code
[00:23:28]
that has been running for years, because we know, well, there are bugs everywhere.
[00:23:34]
So that's why we have all those tools, type systems, test suites, formal logic, manual
[00:23:42]
QA, all those kinds of things, to make sure that we do things correctly.
[00:23:48]
And also, even the processes, like the Agile movement is running your code in such a way,
[00:23:57]
or working in such a way, that you get better results out of it.
[00:24:02]
So we do need to verify our results.
[00:24:06]
And we can't just use the results of the AI willy-nilly.
[00:24:11]
I mean, we can, and people are.
[00:24:13]
I think that's actually kind of the norm.
[00:24:16]
It's going to become increasingly common to see, sort of like, this is a really weird
[00:24:21]
piece of code.
[00:24:22]
Does this even give the right results?
[00:24:24]
Like, oh, somebody just YOLOed this chat GPT or this copilot completion into the code and
[00:24:32]
committed it.
[00:24:33]
Yeah.
[00:24:34]
But I mean, it's something very different from what we do today.
[00:24:38]
Because in a lot of cases, we are still running code and with not a lot of tests in practice.
[00:24:45]
I feel like most people don't write enough tests, myself included.
[00:24:50]
So this is just maybe strengthening the need for adding tests.
[00:24:56]
Exactly.
[00:24:57]
In a way, like our role changes, right?
[00:24:59]
Our role becomes more like verifying and guiding systems rather than like, I can write a line
[00:25:07]
of code.
[00:25:08]
That's not the super valuable asset anymore.
[00:25:11]
Yeah.
[00:25:12]
But I do feel like because it's going to be so easy to write code, and because you don't
[00:25:16]
go through all the steps of writing good code, you're not going to do it as much.
[00:25:22]
For instance, what you like to do, and myself as well, is to do things in a TDD style.
[00:25:29]
You know, you start with a red test, and you change the code to make the test green, but
[00:25:40]
you only change the code as much as necessary for that test to become green.
[00:25:46]
And then you continuously improve or complexify that function until it hits all the requirements.
[00:25:54]
But if I ask the tool, hey, can you give me a function that does this?
[00:26:00]
Well, I probably won't have all the same tests that would have been the results.
[00:26:06]
Yes.
[00:26:07]
Just like running tests after the fact.
[00:26:09]
So you can probably ask the tool to write tests, but do you want an AI to write your
[00:26:16]
tests?
[00:26:17]
Right, exactly.
[00:26:18]
It's kind of like, who monitors the police or whatever that sentence is.
[00:26:25]
Right, right.
[00:26:26]
I totally agree with your framing here.
[00:26:28]
I mean, I think this is a very good way to look at it.
[00:26:32]
And I think, you know, what do we want to take for granted is like how I would think
[00:26:38]
about that.
[00:26:39]
So for example, JSON decoders.
[00:26:42]
Do we want to take JSON decoders for granted?
[00:26:46]
Kind of like we kind of we want to be able to write them with a lot of flexibility, but
[00:26:51]
we don't want to spend a lot of brainpower creating and maintaining them.
[00:26:56]
So I mean, if they're verifiable, that's great.
[00:27:01]
If we can continue to verify them, if we can, I mean, better still, if we can use something
[00:27:08]
like GraphQL to make sure it stays in sync even better.
[00:27:13]
But we don't really want to have to think too much about building and maintaining those
[00:27:17]
low level details.
[00:27:18]
We want that to just be like, given a decoder that works.
[00:27:23]
And so this is a very good thing to delegate to AI and in my opinion, and whereas like
[00:27:29]
solve this complex problem that has a lot of edge cases, and a lot of like things to
[00:27:36]
consider the use case, how do we want it to behave and stuff like these are the types
[00:27:41]
of things that I think our job as an engineer is still extremely relevant.
[00:27:46]
Thinking about the user experience.
[00:27:48]
And in my opinion, I think that engineering, these types of things are going to become
[00:27:54]
a more important part of the job.
[00:27:56]
Thinking about the user experience.
[00:27:57]
Sure these AI systems can sort of do that, but we need like they can, we can tell them
[00:28:03]
think about the user experience and think about these different use cases and think
[00:28:09]
about that in the test suite you write.
[00:28:11]
But I think you want a human involved in really artisanally crafting user experiences and
[00:28:18]
use cases.
[00:28:20]
And then you want to say, okay, now that I've figured these things out, here's a suite of
[00:28:24]
tests.
[00:28:25]
And if some AI thing can just satisfy those tests, maybe you're good, you know?
[00:28:33]
Actually, one of the things that I tried with chat GPT three, so maybe it's better now,
[00:28:39]
but I think my point was to hold is I told it, please write a function that satisfies
[00:28:46]
these elm tests.
[00:28:48]
So I wrote some tests and basically told it to write a function.
[00:28:53]
And it did so and it was pretty good, but it wasn't correct.
[00:28:58]
Like there were syntax errors, which I told it to fix.
[00:29:03]
And when those were gone, well, the, the tests were not passing.
[00:29:06]
Some of them were, but not, not all of them.
[00:29:09]
And the function that I needed was slightly a bit too complex to be such an easy function
[00:29:16]
to implement, as you said before.
[00:29:19]
So basically the code that it wrote was pretty hard to read.
[00:29:24]
And so that means that, okay, I have something that I can use as a basis and that I need
[00:29:29]
to change to, to make the test pass the few failing tests pass.
[00:29:34]
But because it was so complex, I was like, well, how do I make the test pass?
[00:29:40]
Well, to, to make the test pass, I need to change the code to change the code.
[00:29:44]
I need to understand the code.
[00:29:46]
So how do we understand the code?
[00:29:48]
Well, if anything you've taught me is like, or other people in the agile community, like
[00:29:55]
you can get an understanding of the code by changing the code, by doing refactoring techniques,
[00:30:03]
so extracting variables, renaming things, changing how conditions work.
[00:30:10]
And as you do these steps, these tiny steps, because we like them, you start to get some
[00:30:16]
insights into the code and then you can finally notice, oh, well, this is clearly wrong.
[00:30:22]
Now I know what I need to change.
[00:30:25]
And the thing is that I find funny is that this is exactly how you work with legacy code.
[00:30:30]
But this code is only a few seconds old or a few minutes old, which is like working with
[00:30:37]
legacy is becoming even more relevant.
[00:30:41]
Even this new code, which I find very odd and more interesting.
[00:30:46]
That's a nice insight.
[00:30:47]
I like that.
[00:30:48]
I think, I mean, I do think that we need to guide what kinds of results we want also with
[00:30:56]
these steps, with prompt engineering and priming.
[00:31:00]
But I think you're right that this does become a sort of process of creating some code that
[00:31:07]
we can look at its behavior, we can see, we can get a test around it and see that the
[00:31:12]
test is passing and verify it, but then not really understand the code and need to do
[00:31:17]
that process of refactoring to get clarity and get it in the way that fits our mental
[00:31:22]
model or gets away complexity.
[00:31:26]
But also like we can say, you know, here's a unit test, make this, like write some code
[00:31:35]
that makes this test pass.
[00:31:37]
And we can do some prompt engineering that says, do that using the simplest thing that
[00:31:42]
could possibly work.
[00:31:44]
Here's an example of the simplest thing that could possibly work.
[00:31:47]
In this test, there's this error message that the test is giving and you write this thing
[00:31:52]
that, okay, sorting a list, it returns the hard-coded list and it makes it green.
[00:31:58]
And that's the simplest way it could make that work.
[00:32:01]
So you can actually illustrate that with examples.
[00:32:04]
You can write very long prompts and you can get it to do a sort of fake it till you make
[00:32:11]
it style process that you can actually understand.
[00:32:15]
So you can get it to like follow the kind of process you would follow and it totally
[00:32:20]
changes the results you get.
[00:32:22]
And if you've, in addition to that, connect it to test output and compiler output so it
[00:32:27]
can iterate on that, you can actually like automate some of those things, which starts
[00:32:32]
to become very interesting.
[00:32:33]
I'm wondering whether that would have the same effect in the sense that if I don't see,
[00:32:40]
if I do this and I only see the end results, which is kind of the point, well, will I have
[00:32:46]
an insight into how this function works because I didn't write it.
[00:32:50]
So now it's just like someone else's code.
[00:32:52]
And again, if I need to change it, then I need to go through all those refactoring steps
[00:32:57]
or making it easier to understand for myself or just go read it well.
[00:33:05]
But definitely the thing that I will keep in mind is that all these techniques about
[00:33:12]
running good code, they will stay relevant.
[00:33:15]
So if I don't want to lose my job, this is the kind of things that I can maybe should
[00:33:21]
focus on because I think that these will stay relevant.
[00:33:25]
Maybe my whole job will be removed.
[00:33:27]
Maybe I will get fired if it has become way too good.
[00:33:31]
But maybe my chances of not being fired increase if I am one of those who are better at these
[00:33:37]
tasks.
[00:33:38]
Right.
[00:33:39]
Yeah.
[00:33:40]
And one of the things that keeps coming up for me is like, what do I want to be atomic?
[00:33:45]
Like there's a certain philosophy of using tools that I've arrived at through a lot of
[00:33:51]
craftsmanship principles and TDD and things like that, which is like, I don't want tools
[00:34:00]
that I can partially trust and I don't want tools that give me partial results.
[00:34:04]
I want tools that I can completely trust and that allow me to take a set of low level steps,
[00:34:12]
but think of them as one high level step.
[00:34:15]
So to me, that's the question.
[00:34:16]
Now, in the case of making a red test green and a TDD step, for example, like do the simplest
[00:34:24]
thing that could possibly work.
[00:34:26]
What if that was an atomic step I could take for granted?
[00:34:30]
That instead of a set of low level steps, I will look at the code, I will hard code
[00:34:36]
the return value, I will create a new module with the name that's failing.
[00:34:40]
It says could not find module of this name.
[00:34:42]
I will create that module.
[00:34:43]
I will create a function of the name that the error message in the failing test says
[00:34:48]
is missing.
[00:34:49]
I will write a type annotation that satisfies the compiler and return an empty value and
[00:34:56]
have a failing test.
[00:34:58]
And then to make it green, I will change that empty value to a hard coded value that makes
[00:35:03]
the test green.
[00:35:05]
What if I could just take that for granted and say, hey, computer, do that step, do that
[00:35:09]
TDD step to make it red and then make it green in the simplest way possible.
[00:35:13]
And I could take that for granted and then I can take it from there.
[00:35:15]
That would be great.
[00:35:16]
And then that's something I can fully trust and I can sort of verify it.
[00:35:22]
And so another principle I've been thinking about in sort of like designing these prompts
[00:35:27]
and these workflows using AI tools is guardrails.
[00:35:31]
So like not only verifying something at the end that it did the correct thing because
[00:35:37]
you can run the Elm compiler, you can.
[00:35:39]
But along the way, if you can say, OK, like, for example, you can create a new module and
[00:35:46]
a new function, but you can't touch any other code and you can't touch the test.
[00:35:53]
The test has to remain the same and the test must succeed at the end.
[00:35:56]
You sort of set up guardrails and you say, listen, if the AI given these guardrails can
[00:36:03]
give me a result that satisfies all these criteria by the end of it, then if it does
[00:36:09]
that, I can verify that it gave me what I wanted and I can fully trust it.
[00:36:14]
Those are the types of tools that I want.
[00:36:16]
So one thing that I was really amazed by, I'll share a link to this tweet, but I saw
[00:36:23]
this demo where this was actually with GPT-3, but this example stuck with me where somebody
[00:36:31]
was finding that GPT-3 did a poor job if you asked it questions that went through sort
[00:36:38]
of several steps.
[00:36:40]
Like if you said, what is the capital of the country where the Taj Mahal is?
[00:36:47]
Then it would give Agra or something like the city where the Taj Mahal is instead of
[00:36:53]
New Delhi, which is the capital of India.
[00:36:55]
So what they did is they did some prompt engineering.
[00:37:00]
So they gave it a starting prompt, which said, here's an example of doing this thing.
[00:37:06]
And they kind of gave an example question.
[00:37:09]
They gave some intermediaries questions where it said, okay, well, in order to answer this
[00:37:14]
question, I need to answer an intermediary question first.
[00:37:18]
And so they gave an example of that as the sort of context for the prompt.
[00:37:23]
And then they said, now answer this question.
[00:37:25]
Question, what is the capital of the place where the Taj Mahal is, the country where
[00:37:32]
the Taj Mahal is?
[00:37:33]
And then it went ahead and followed that set of steps.
[00:37:37]
Intermediary question, what country is the Taj Mahal in?
[00:37:41]
Answer, India.
[00:37:43]
Intermediary question, what is the capital of India?
[00:37:47]
New Delhi.
[00:37:48]
Simple answer, New Delhi.
[00:37:50]
And it got the correct answer.
[00:37:51]
So it got higher quality results because it was guided to break the problem down into
[00:37:57]
sub problems.
[00:37:58]
And pretty interesting, right?
[00:38:01]
Yeah.
[00:38:02]
It's a bit funny because I feel like everyone has this like, oh, well, you know, if I tried
[00:38:09]
to chat to JPT and didn't give me great results, but then I tried to prime it or I tried to
[00:38:16]
give this kind of prompt or written this way, and now we get great results.
[00:38:21]
And I feel like maybe everyone will have their own ideal prompt and people will share it.
[00:38:29]
It's kind of like, well, I have my set of key bindings of shortcuts for my computer.
[00:38:35]
Oh, you don't have a shortcut for this action in your ID?
[00:38:39]
Oh, let me share it with you.
[00:38:41]
Or have their own proprietary prompts.
[00:38:44]
Maybe yeah.
[00:38:45]
And we will start to have like our very custom experience around working with AI.
[00:38:51]
It's like, hey, this is how I do it.
[00:38:54]
And this works for me.
[00:38:55]
And this might not work for you.
[00:38:57]
Yeah.
[00:38:58]
And then it'll be like, here's a very good prompt for generating the best prompt.
[00:39:06]
I kind of feel like maybe people who use Vim will have something like that.
[00:39:13]
There's a real art to it.
[00:39:18]
And I mean, you're getting it to break problems.
[00:39:21]
So I took this concept, and I applied this idea of breaking the problem down into sub
[00:39:27]
problems.
[00:39:28]
I actually had written this blog post years back about like solving Elm code, like solving
[00:39:36]
type puzzles in Elm, like a jigsaw puzzle frame then fill in.
[00:39:41]
So like a jigsaw puzzle, you start by filling in the borders and the corner.
[00:39:47]
The corner pieces are easy to find.
[00:39:48]
So you find the corners, then you've got sort of a set of fixed points.
[00:39:53]
So that's like one low hanging fruit.
[00:39:56]
It's easy to solve those problems.
[00:39:58]
Then you find the edge pieces and you can fill those in.
[00:40:00]
And now that you've got the edges, it makes solving the rest of the puzzle easier, right?
[00:40:05]
So that's one approach to solving jigsaw puzzles to break it down into sub problems.
[00:40:09]
But like with Elm types, I kind of, I use this technique a lot when I'm writing Elm
[00:40:15]
code as a human.
[00:40:16]
I will, I'll say like, okay, I don't know exactly what's going to fit here in this pipeline.
[00:40:23]
But I know I want to like take this starting value, I want to do something to it.
[00:40:29]
And then I want it to be passed through in this pipeline to this next function.
[00:40:36]
Right?
[00:40:38]
So sometimes I'll just like put a debug.todo there.
[00:40:41]
And then maybe I'll extract that debug.todo to a function or a let binding.
[00:40:46]
And then I'll try to get a type annotation for that value I have in my let binding.
[00:40:52]
That would satisfy the compiler.
[00:40:55]
Exactly.
[00:40:56]
Now I've broken it down into a sub problem.
[00:40:59]
So I took this sort of like, fill in this code, I don't know what goes here, I've turned
[00:41:03]
it into, okay, I know the type I need.
[00:41:06]
So that's sort of like finding the edge pieces in the puzzle.
[00:41:10]
So now I've created the sub problem for myself.
[00:41:13]
And now I can do things like, so I've got a debug.todo with a type annotation.
[00:41:20]
Now I can turn that into maybe result.map around a debug.todo or list.map with a debug.todo.
[00:41:29]
So now I'm saying, well, I know that if I apply some function over a list, it will work.
[00:41:38]
And now I've further broken down that sub problem.
[00:41:40]
And now I can follow that step again and say, okay, we'll break out another, that debug.todo,
[00:41:46]
give that a type annotation.
[00:41:47]
So now it's list.map, some function, I don't know what, now follow that same process with
[00:41:52]
that.
[00:41:53]
So it's breaking it down into sub problems.
[00:41:55]
I use this technique all the time when I'm like, often with like API design, you're doing
[00:42:01]
weird type puzzles, but also just with like user code, like trying to parse some markdown
[00:42:08]
and take the markdown blocks and find and traverse them and map them into this type
[00:42:13]
and whatever.
[00:42:14]
So I use this technique a lot.
[00:42:16]
Now I tried to use this sort of same prompt engineering idea to teach GPT how to follow
[00:42:24]
this set of steps of breaking down a type puzzle.
[00:42:28]
And it was actually really good at it.
[00:42:30]
So I'll share like a little GitHub gist of my GPT prompt and the results it got.
[00:42:39]
But what I basically did is I told it, I said, your job is to solve this type puzzle.
[00:42:46]
And I gave it some guardrails.
[00:42:48]
So like the guardrails I gave it were, I'm going to give you some code, which has debug.todo
[00:42:54]
replace me in it.
[00:42:56]
Your job is to, you know, get a, satisfy the type for that debug.todo.
[00:43:02]
And your final solution cannot include debug.todo.
[00:43:06]
You can write intermediary steps, which may include debug.todo.
[00:43:10]
And you are not allowed to change any code other than the section that says debug.todo.
[00:43:16]
So I gave it these guardrails.
[00:43:17]
Also these are verifiable things, right?
[00:43:19]
So you can test for this to see if it's given you a valid solution, given the guardrails
[00:43:25]
you wanted it to honor, because it might hallucinate and not do that, but you can check that.
[00:43:31]
Yeah.
[00:43:32]
So one thing that I'm thinking of is, will you be able to verify things accurately?
[00:43:39]
Maybe I'm being too, I'm trying to play the devil's advocate here a bit, and I might be
[00:43:44]
a bit too hard on chat.gpt.
[00:43:47]
But for instance, whenever you're working in that TD style, when you do things one step
[00:43:52]
at a time, you discover edge cases, right?
[00:43:56]
So for instance, you give a list as an argument and needs to return a number.
[00:44:01]
And first you hard code that number.
[00:44:03]
And then you notice, Oh, well, what if that list is, is, is empty then?
[00:44:08]
Oh, well then I need to write a test for if the, the, the list is empty.
[00:44:14]
Ah, okay.
[00:44:15]
So I'm going to do that.
[00:44:17]
But the, the AI might not do that, might not notice that.
[00:44:20]
So maybe it's, it is going to fix things correctly.
[00:44:24]
Maybe not, but let's say it's going to do it correctly, but it's not going to have a
[00:44:27]
test for that.
[00:44:29]
Or you're not going to know, or you're going to, I mean, you are not going to notice that
[00:44:36]
you're going to need to write a test with an empty list.
[00:44:39]
So that's the process is a bit hard to figure out if you don't do it yourself.
[00:44:45]
It's kind of like, I think also one of the reasons why people say, well, you should pair
[00:44:49]
program rather than review someone else's code, because you will discover those, those
[00:44:55]
things while you're working.
[00:44:57]
Yeah, totally.
[00:44:58]
Yeah, I agree.
[00:44:59]
I think, I think that's, I think that that's something that's going to play out more and
[00:45:03]
more these days.
[00:45:04]
I think we're going to see like a lot of junior developers using these AI tools in exactly
[00:45:10]
the kind of way you're describing where maybe they trust it too much to do too many steps.
[00:45:18]
And then what happens is you're not really engaging with the problem intellectually, and
[00:45:24]
you're not thinking about these test cases that come up.
[00:45:27]
So I think there's an art to knowing when to use it.
[00:45:31]
So like the type of problem here for this sort of frame then fill in problem I'm talking
[00:45:36]
about, this is this is a class of problem that I find myself spending a lot of mental
[00:45:43]
effort solving on a regular basis.
[00:45:45]
That is kind of this, this, you know, it has this quality we talked about with a traveling
[00:45:50]
salesman where you know it when you see it, if you have a good solution, you can easily
[00:45:54]
verify that it that it solved it.
[00:45:57]
And yet it's not really doing anything too creative, because it's fitting pieces together.
[00:46:02]
It's not really writing too many implementation details.
[00:46:06]
And I find that often with Elm code, you arrive at these types of situations where like, if
[00:46:11]
you could make the types work, you would trust that the code worked because like, there's
[00:46:16]
only really one good way to fit these functions together to get the right thing.
[00:46:20]
Like you're not doing too much logic of like, give it this empty value and give it this
[00:46:25]
now it might hallucinate these types of things.
[00:46:27]
But you could even use prompt engineering to tell it like, you're just fitting these
[00:46:33]
functions together.
[00:46:34]
I don't want you to write new logic or use default values.
[00:46:37]
So I think these types of things can be improved through prompt engineering and also through
[00:46:41]
selecting the right types of problems.
[00:46:43]
But like, for example, the I gave it a pretty, pretty challenging problem with this sort
[00:46:50]
of prompt I designed.
[00:46:52]
I had it fill in this, this thing in a in an Elm pages example that I have where it
[00:46:58]
takes markdown blocks and it traverses these headings and it and I what I did is I primed
[00:47:08]
it with a list of all of the available functions that it could use.
[00:47:15]
And another thing you can do a set of guardrails is you can say only use these functions.
[00:47:19]
And you could even say you must use these functions.
[00:47:23]
And these other functions are available and you may not use any other functions.
[00:47:27]
And of course, these things are verifiable in the in the final output easily.
[00:47:31]
Right.
[00:47:32]
But why would you tell it you can only use these functions because you're now limiting
[00:47:38]
limiting its creativity.
[00:47:41]
For instance, if you forget to mention list.map, then it's not going to use that.
[00:47:46]
And it's going to use something else like list.fold instead.
[00:47:50]
Well, so the the way basically I was doing this as a proof of concept of saying, I'm
[00:47:58]
going to give you all of the functions that are in scope in this particular code base.
[00:48:04]
And I'm going to give you like all of the functions from from the list module and from
[00:48:09]
the result module.
[00:48:10]
So you can give it like a certain set of available functions and say, these are the types and
[00:48:14]
I taught it like I even taught it how partial application works.
[00:48:18]
So I can take an example.
[00:48:20]
And I said, given this type, if you pass in this function, now the type annotation is
[00:48:25]
this.
[00:48:26]
And it I played around with it and tweaked it in these ways.
[00:48:29]
And it did a better job at solving these puzzles.
[00:48:32]
So it's pretty interesting.
[00:48:33]
You can kind of teach it in these prompts.
[00:48:35]
Yeah.
[00:48:36]
But you don't want to limit its creativity too much.
[00:48:40]
Right.
[00:48:41]
Yeah.
[00:48:42]
Also.
[00:48:43]
So but I get your point.
[00:48:44]
Right.
[00:48:45]
I wanted to solve a sort of uncreative problem of wiring things together that I don't really
[00:48:52]
like if I could automate that as an atomic step, I would love to like if I could, you
[00:48:57]
could even think of it this way, like, AI, give me all of the possible solutions using
[00:49:04]
the functions in scope here to satisfy this type, right?
[00:49:09]
Just like, and then you can just select, okay, these are all the valid ways to do that.
[00:49:13]
So if I can teach through a GPT prompt, the AI to solve that type of puzzle, and give
[00:49:20]
me all the possible results, and then I can use a tool to actually verify those results.
[00:49:25]
So I so I know I can 100% trust them.
[00:49:28]
That becomes a very interesting tool in my toolkit, where now I'm more capable as a programmer.
[00:49:34]
And I'm not sort of like hallucinating weird things into my code base, or as you said,
[00:49:39]
like having it write out these new cases that I'm not considering in my testing or considering
[00:49:45]
how it affects the user experience.
[00:49:47]
And if that's what I want the experience to be, it's just like, how do I solve this type
[00:49:51]
problem?
[00:49:52]
Oh, yeah, that's the only one sensible, sensible, meaningful solution, and it found it.
[00:49:58]
And I can easily look at it and say, oh, yeah, result dot map, tuple dot map first list dot
[00:50:05]
map.
[00:50:06]
Yes, that it didn't use anything too crazy.
[00:50:10]
It satisfies the types.
[00:50:11]
It's good.
[00:50:12]
I can easily look at it and see it did the right thing.
[00:50:14]
But it would have taken me a long time to solve it myself.
[00:50:18]
And so in case it wasn't clear, my idea is to like, this is something I want to experiment
[00:50:24]
a little more with the OpenAI API to fully automate this.
[00:50:28]
And because it's a pretty easy thing to automate to just say, what are all the types of all
[00:50:34]
the functions in in scope here?
[00:50:37]
Like that's a an automatable thing.
[00:50:40]
So feed it that into the prompt and give it the ability through, you know, through writing
[00:50:45]
a small script that hits the OpenAI API, tell it what the compiler error is to let it iterate
[00:50:52]
on.
[00:50:53]
So when I gave it this problem as a proof of concept manually, I manually told it the
[00:50:58]
compiler errors and it with two iterations with telling it the compiler error, it was
[00:51:03]
able to get the correct result, which I thought was pretty cool.
[00:51:06]
So one thing that for now I'm feeling is a bit of a problem, but it will probably be
[00:51:12]
solved pretty soon, very soon.
[00:51:16]
Is that, for instance, at the moment we do everything through JGPT because that's a lot
[00:51:22]
better than Copilot so far.
[00:51:25]
But that means that every time you ask a new problem, you need to prime it again, you need
[00:51:29]
to give it the context and the rules.
[00:51:33]
So for instance, if you want to say, well, I have this problem here that I'm trying to
[00:51:37]
solve and I don't want to spend mental power on doing it.
[00:51:41]
So I'm asking the AI to do it for me, but I need to give it the functions in my codebase.
[00:51:47]
Well, that's a lot of work.
[00:51:50]
And so for a moment, we do it with JGPT, you always need to write those functions in the
[00:51:58]
prompt.
[00:51:59]
But at some point, I'm guessing that they will be able to analyze your codebase or your
[00:52:05]
source file, and then it will be able to solve the problem.
[00:52:09]
So a lot of our work as developers is not writing new code, it's editing existing code.
[00:52:15]
So I feel like that's going to be somewhat missing now, but it's probably going to be
[00:52:21]
solved pretty soon.
[00:52:24]
The only question is how much input can give those AIs, and that's pretty low at the moment,
[00:52:30]
I think.
[00:52:31]
Actually, GPT-4, can't it take like 25,000 tokens as input?
[00:52:36]
So you can feed it a huge input.
[00:52:37]
That's nice.
[00:52:38]
That has improved more.
[00:52:40]
That's a game changer.
[00:52:41]
Yeah, yeah.
[00:52:42]
So you can feed it all of your documentation or all, you can give it huge inputs.
[00:52:48]
Cool.
[00:52:49]
Yeah.
[00:52:50]
But until then, I'm thinking, for instance, if we had a tool that's extracted information
[00:52:56]
from your codebase, and that you can then just copy paste into the prompt, that could
[00:53:02]
be pretty cool.
[00:53:03]
So like having all the types for the functions.
[00:53:06]
And there is a tool that is called Elm Review, which has an extract feature.
[00:53:11]
Yeah, exactly.
[00:53:12]
To get whatever information is needed.
[00:53:15]
But yeah, that's still going to be quite annoying.
[00:53:18]
Like you probably don't want to send the types for all the APIs in your codebase.
[00:53:23]
But maybe that could be interesting.
[00:53:25]
Unless you automate it, and why not?
[00:53:27]
It gives good results.
[00:53:29]
Yeah, what I mean is more like if you need to give too much inputs in a way that the
[00:53:34]
AI will not be able to parse that or understand that, or it's just too big.
[00:53:40]
Like I work on a 200,000 lines of code, codebase.
[00:53:46]
But how many type annotations does that represent, right?
[00:53:51]
Like hundreds of thousands, probably?
[00:53:54]
You think so?
[00:53:55]
That are in scope in a particular point in code?
[00:53:58]
Well, you can import anything.
[00:54:00]
Not everything is exposed, probably.
[00:54:01]
Yeah, exactly.
[00:54:02]
Yeah.
[00:54:03]
And a lot of things are going to be values that are locally scoped to let like I would
[00:54:08]
I would venture to guess in a 200,000 line codebase.
[00:54:12]
With code comments?
[00:54:13]
Or maybe there are a thousand.
[00:54:16]
Maybe there are like on the order of one to 10,000.
[00:54:20]
No more than definitely no more than 10,000.
[00:54:22]
Yeah, no, if you only include the exposed things or the things in scope of that file,
[00:54:26]
then yeah, that's, that's a lot less.
[00:54:28]
Oh, there's also dependencies, but that's also not that much.
[00:54:33]
Right, maybe it's doable.
[00:54:36]
And you can do heuristics to filter and not even heuristics, like reliable heuristics
[00:54:43]
to filter out.
[00:54:44]
You know, you know that if you're trying to arrive at this type, but none of the types
[00:54:51]
connect in any way.
[00:54:52]
So if you can take a string and use it on this thing, and you can take an int and turn
[00:54:58]
it into a string, then those two things connect.
[00:55:01]
But if a if this custom type can't be turned into a string, then you know it, it's not
[00:55:09]
going to be involved in your problem at all, because your problem is dealing with strings,
[00:55:13]
and you can't turn that to or from a string, for example.
[00:55:17]
Yeah, you can also remove all the modules that would create an import cycle.
[00:55:22]
Right.
[00:55:23]
So basically, you can't import anything that imports this file directly or indirectly.
[00:55:28]
Exactly.
[00:55:29]
Yeah.
[00:55:30]
So to me, this is the really interesting intersection.
[00:55:33]
So now you were mentioning earlier that you think that these tools will start to understand
[00:55:38]
your code more over time, but we're not there yet.
[00:55:41]
I actually, I don't see it that way.
[00:55:44]
I believe that these tools are going to continue doing what they're doing, which is that they've
[00:55:49]
been remarkably successful in being able to solve complex problems just through this crazy
[00:55:56]
synthesis and predictive text sort of thing.
[00:56:00]
No, I didn't mean it in the sense of understanding.
[00:56:02]
I meant it's just of gathering the information.
[00:56:07]
Like every time you ask something to Jadgipty, you need to provide information about your
[00:56:12]
code base.
[00:56:13]
At the moment, it does not look at your code base.
[00:56:15]
I see.
[00:56:16]
I see.
[00:56:17]
Right, right.
[00:56:19]
But I don't think that they will, for example, know type information about your code base,
[00:56:25]
except insofar as it's part of the predictive text because it's in there.
[00:56:29]
But I think that they're getting enough mileage solving problems through this sort of predictive
[00:56:36]
text, that they're going to keep going with that.
[00:56:39]
But I think the interesting intersection, especially with typed pure functional programming
[00:56:46]
languages is if you, so humans have their role, these sort of like compiler tools and
[00:56:55]
static analysis tools have their role, and these AI tools have their role.
[00:56:59]
So with this trifecta, I think each of these pieces needs to do what it is best at.
[00:57:06]
Compilers are good at verifying things.
[00:57:08]
Humans are good at, do we even need humans anymore?
[00:57:15]
Humans are good at critically thinking, guiding these tools.
[00:57:20]
Humans have goals.
[00:57:24]
Humans are good at gathering requirements.
[00:57:27]
Exactly.
[00:57:28]
I'm not going to say they're good at it, but at the moment they're better than a machine.
[00:57:33]
Exactly.
[00:57:34]
And they have to because humans have goals.
[00:57:36]
The AI's job is not to have goals.
[00:57:38]
Yeah.
[00:57:39]
Humans have goals for humans.
[00:57:43]
When a machine wants to make a program for a machine, then it can do it on its own.
[00:57:48]
This is absolutely not discrimination that I'm mentioning.
[00:57:51]
God.
[00:57:52]
Yeah.
[00:57:53]
The human is the customer.
[00:57:55]
The human is the one that gets to say whether you solved the problem or not, that gets to
[00:58:00]
make the calls of what the problem you're solving is.
[00:58:02]
So that's like, the human needs to do that.
[00:58:05]
There's no substitute for that.
[00:58:07]
Yeah.
[00:58:08]
Because as you said, if the customer is a machine or an API or something, then you can
[00:58:15]
automate it.
[00:58:16]
So the human only asks, well, I need this, and then the machine can do the rest.
[00:58:22]
And you can have these feedback cycles with compilers and all kinds of test suites.
[00:58:29]
So yeah.
[00:58:30]
Exactly.
[00:58:31]
Yeah.
[00:58:32]
So if that trifecta is what becomes really interesting to me, the human sets the goals
[00:58:37]
and can sort of validate these criteria and accept or not accept them.
[00:58:42]
The compiler is a verification tool.
[00:58:46]
It is a tool for giving information through static analysis that is guaranteed correct
[00:58:52]
information and checking that information.
[00:58:55]
Review and other static analysis tools can provide similar input and verifications.
[00:59:01]
And AI can piece things together using those guardrails and inputs and verifications provided
[00:59:08]
by those other external systems.
[00:59:10]
So when those three things are sort of interacting, then I think it becomes really interesting,
[00:59:15]
especially, as I said, when we are using these things to create higher level building blocks
[00:59:21]
as humans.
[00:59:23]
So we can say, give me a decoder.
[00:59:25]
And I know that it satisfies these things.
[00:59:27]
And I don't have to use brainpower to check that because I know it's an automated verification
[00:59:31]
of that.
[00:59:32]
So I can trust it.
[00:59:34]
Give me a fake it till you make it simplest thing that could possibly work green test
[00:59:38]
for this test case and give it guardrails that allow me to trust that it's not going
[00:59:44]
beyond that and filling in implementation details.
[00:59:48]
Then you can actually trust these things.
[00:59:50]
And yeah, well, there's there's one question of, do you even need a compiler or type checker
[00:59:58]
in the linter and the test suites?
[01:00:01]
Could you not just ask the AI to verify things?
[01:00:04]
Yeah.
[01:00:05]
But then it comes again to the point of, well, who monitors who?
[01:00:10]
How do you trust the right checks?
[01:00:13]
Right, exactly.
[01:00:14]
And at the end of the day, we we do trust the compiler.
[01:00:17]
Now, that said, it is possible for the compiler to have bugs and it can.
[01:00:23]
But for all intents and purposes, we fully trust the compiler.
[01:00:27]
We fully trust Elm Review.
[01:00:28]
Of course, possible for these things to have bugs.
[01:00:30]
But I think that's a good assumption.
[01:00:32]
Whereas with AI, I don't fully trust it unless I verify it.
[01:00:36]
Yeah.
[01:00:37]
The thing that is very important for me with regards to the compilers and linters and test
[01:00:43]
suites is that these are consistent.
[01:00:47]
Like if you run the same code, if you ask the compiler to verify the same code, it's
[01:00:52]
going to give you the same results.
[01:00:54]
If you run the same code in a test suite, it's going to give you the same results.
[01:00:59]
If you ask the AI to review your code, like, hey, are there any consistency issues that
[01:01:06]
the linter would tell me, for instance, then from one run to another, it could tell you
[01:01:12]
different things.
[01:01:13]
Right.
[01:01:14]
It's kind of like asking a human, hey, can you please review this code and tell me how
[01:01:20]
you can improve it?
[01:01:21]
Well, if I ask you today to do this seriously on my code base, you're going to find a lot
[01:01:26]
of problems.
[01:01:27]
If I ask you tomorrow to do it again from scratch, you're going to give me a whole different
[01:01:32]
kind of problems.
[01:01:33]
Like, oh, well, I think I can rewrite this function.
[01:01:37]
Sure.
[01:01:38]
But maybe it's good enough.
[01:01:39]
Yeah.
[01:01:40]
Linters, when they're dealing with consistency, they give you a certain minimum of consistency
[01:01:50]
of code that is written in a specific way.
[01:01:53]
And it could go higher, probably.
[01:01:56]
Like you want all our functions to be named in a very similar way, for instance, but that's
[01:02:03]
probably a bit too hard for a linter.
[01:02:06]
An AI would always tell you different things, and we don't want that.
[01:02:10]
So we need these to be trustworthy and consistent in the sense that it doesn't give you different
[01:02:16]
results every time.
[01:02:18]
Right.
[01:02:19]
And the lower level the task, the more we can trust it.
[01:02:22]
Just like Elm types, because the type system is so simple, it's easy to trust it.
[01:02:27]
Whereas TypeScript, it's so permissive, it's hard to trust it.
[01:02:32]
And there are so many caveats and exceptions that it's hard to trust such a complex and
[01:02:39]
permissive system.
[01:02:40]
Yeah.
[01:02:41]
So I do think that this might be a superpower of Elm.
[01:02:44]
And honestly, I think that maybe this could be a really appealing thing about Elm that
[01:02:50]
makes it more mainstream.
[01:02:53]
That, wow, this language, it turns out it's really good for automating and tooling.
[01:02:59]
And you know what?
[01:03:01]
Automating and tooling is really hot these days because people are building all sorts
[01:03:04]
of AI automation.
[01:03:05]
And we can have trusted AI automation.
[01:03:11]
So I think we're at this early stage where people are just sort of letting AI just write
[01:03:16]
their code, which is kind of crazy.
[01:03:19]
They're letting AI just execute shell commands for them.
[01:03:23]
I saw a recent thing where somebody like...
[01:03:28]
We all knew it was going to happen when you start letting AI just fill in commands in
[01:03:33]
your shell.
[01:03:34]
But somebody basically like RMRFed their drive or broke their computer and are trying to
[01:03:40]
fix it.
[01:03:41]
We all knew it was going to happen.
[01:03:42]
It's kind of a crazy state of things, right?
[01:03:44]
But if we can have tools that we can really trust and not have to worry about it doing
[01:03:50]
anything that's going to put things in a bad state or go beyond the scope of what we're
[01:03:55]
trying to do, just like perfectly reliably solve a difficult problem that we can now
[01:04:01]
take for granted.
[01:04:03]
That's awesome.
[01:04:04]
And I think Elm is a really good fit for that.
[01:04:06]
Yeah.
[01:04:07]
I've also heard the opposite point of view where this could be pretty bad for Elm or
[01:04:13]
for smaller languages in the sense that the AI is trained on code that is available.
[01:04:21]
And there's not a lot of Elm code out there compared to more mainstream languages like
[01:04:26]
JavaScript.
[01:04:27]
So this could make adoption of new languages harder or smaller languages in general.
[01:04:35]
But as you said, if there are guarantees like the ones that Elm provides, that can even
[01:04:42]
out the playing field.
[01:04:44]
But if you're designing a language that doesn't have the same guarantees as Elm, and it's
[01:04:49]
just very new or very small, then you get kind of the worst of both worlds.
[01:04:55]
Right.
[01:04:56]
And this all depends on writing the tooling, right?
[01:05:00]
And so I think we have an opportunity to build really cool stuff leveraging these techniques
[01:05:07]
right now.
[01:05:08]
So I'm definitely going to be playing around with that.
[01:05:10]
Like I've got a lot of ideas.
[01:05:12]
I want to make this sort of automated type puzzle solver.
[01:05:17]
I think, you know, having it build JSON decoders starts to become really interesting where
[01:05:25]
like Mario and I were working on this Elm HTTP fusion thing, which is really cool for
[01:05:31]
like having a UI where you make an HTTP request, and then you can sort of click the JSON fields
[01:05:39]
you want and it generates a decoder.
[01:05:41]
It's like, that's great.
[01:05:42]
But what if you can tell it the type you want and it can figure out what fields to get and
[01:05:49]
generate something that is provably correct because you actually ran it and verified it,
[01:05:55]
and then you can fully trust it, but it just solves your problem.
[01:05:58]
And it sort of can solve that last mile problem where like, there are so many things I've
[01:06:03]
been trying to automate where it's difficult to do that last little piece of the puzzle
[01:06:09]
and AI can do that missing piece.
[01:06:11]
So I think this unlocks some really cool things.
[01:06:15]
I've been thinking about like some other use cases I'm thinking about are like, so for
[01:06:19]
example, like with Elm GraphQL, you know, we've talked with Matt about Elm GQL, which
[01:06:25]
sort of tries to be a simpler way of just taking a raw GraphQL query as a string.
[01:06:32]
And it's very easy to interact with GraphQL APIs through this raw query string.
[01:06:39]
And then it can generate type aliases for you of the response you get, and you just
[01:06:45]
paste in your GraphQL query string and it spits out some Elm code to execute that query.
[01:06:52]
And the trade off with that approach in Elm GQL versus Elm GraphQL, as we talked about
[01:06:57]
in our Elm GQL episode is with Elm GraphQL, you have to explicitly write everything you're
[01:07:05]
decoding in Elm code.
[01:07:07]
But you can maintain it in Elm code and you get more fine grained control over the types
[01:07:12]
you decode into.
[01:07:14]
So there's a trade off.
[01:07:16]
But what if you had a tool that generated an Elm GraphQL query, you get complete control
[01:07:24]
over the fine grained code and that you decode into, but what if you could just tell an AI
[01:07:31]
tool generate an Elm GraphQL query.
[01:07:33]
And using this sort of type puzzle solver I built, I can say here are all the functions
[01:07:39]
for generating Elm GraphQL types, solve this problem.
[01:07:44]
And here's the raw GraphQL query.
[01:07:46]
And here is the resulting Elm type I want.
[01:07:50]
And it could, I think it could solve that pretty well.
[01:07:54]
So some of these tools become more interesting when you have that extra bit of glue from
[01:08:00]
AI.
[01:08:01]
And that would solve all of Elm's problems because all of Elm's problems are boilerplate.
[01:08:07]
Exactly.
[01:08:08]
It's boilerplate that's really easy to maintain once you have it.
[01:08:12]
So if it's very easy to confidently write boilerplate, then yeah, Elm becomes a lot
[01:08:17]
more exciting.
[01:08:18]
If we take your last example, it does mean that you redo the same logic every time and
[01:08:24]
not necessarily in a framework or library oriented way.
[01:08:31]
So you would redo, you would inline the creation of the GraphQL query and decoding those instead
[01:08:39]
of using a pre-made library, which simplifies the API for that.
[01:08:45]
But it could be very interesting nonetheless.
[01:08:48]
Yeah.
[01:08:49]
Yeah.
[01:08:50]
I think part of the challenge right now to using these tools effectively is like defining
[01:08:56]
the problems and the workflows to leverage these as much as possible.
[01:09:02]
Another thing on my mind here is like refactoring.
[01:09:05]
So we have, you know, if you build in an IntelliJ refactoring for like extracting a function
[01:09:13]
to a module, like what kinds of refactoring should we invest in building in like IDEs
[01:09:21]
or language servers versus using AI?
[01:09:24]
I mean, we could also just ask an AI to write those things to be integrated into the ID
[01:09:33]
for instance.
[01:09:34]
So for instance, if you go back to the linter example, I don't want an AI to review my code
[01:09:43]
because it's going to be inconsistent.
[01:09:45]
I can ask it to write a linter rule once and then I can run that linter rule multiple times.
[01:09:51]
But yeah, I definitely agree that there are cases where you will want to have a transformation
[01:09:59]
using AI rather than one that is hard-coded one way or another in an IDE.
[01:10:05]
That could be interesting to find.
[01:10:08]
Yeah.
[01:10:09]
And I mean, I don't know.
[01:10:12]
I'm very bullish on what we can do with these AI tools.
[01:10:17]
But I'll have you ask yourself whether you should.
[01:10:22]
Well, that's another question.
[01:10:26]
The thing I'm bearish on would be just saying AI build a plugin.
[01:10:34]
You know, people are, there's a lot of hype around like it built a Chrome extension for
[01:10:39]
this thing.
[01:10:40]
It built a whole app from a sketch on a napkin.
[01:10:42]
And so it's like, okay, that's very impressive.
[01:10:46]
It's very interesting, but like how I am skeptical of how useful that is going to actually prove
[01:10:54]
to be.
[01:10:55]
Like, I don't feel like that's what's going to take people's jobs away.
[01:10:58]
I don't feel like that's what's going to replace the work we're doing day to day.
[01:11:01]
I think it's these more mature things that we can really rely on where we're choosing
[01:11:07]
more constrained problems to do higher level operations and verify them and put guardrails
[01:11:13]
on them.
[01:11:14]
Like, I don't know.
[01:11:15]
I think that's my personal bias and obsession and people will get over that and not worry
[01:11:21]
about that and be able to do cooler things than I can do.
[01:11:24]
That's very possible.
[01:11:25]
I admit that's a possibility, but that's where I'm putting my money.
[01:11:29]
So like writing, having it write the IDE completions for extracting functions and things like that.
[01:11:38]
Like it's like I can, the hard part isn't writing like the happy path.
[01:11:46]
I can write the happy path of that.
[01:11:47]
I've actually, I've done that in IntelliJ refactorings.
[01:11:53]
The hard part is everything else that it's not considering.
[01:11:56]
And if I have to babysit it to make sure it solved each of those cases, I may as well
[01:12:01]
do it myself.
[01:12:02]
Cause like the things it's going to miss, the things that I don't trust that it did
[01:12:07]
and I have to go check myself, it's easier to do them myself and engage with the problem
[01:12:13]
and solve it my way and know that I accounted for every corner case and wrote a test for
[01:12:18]
it than to just trust the AI and be like, okay, now I have to go check everything that
[01:12:23]
it did in this crazy, impossible to understand code.
[01:12:26]
That's not the way I would have solved it.
[01:12:29]
But if you paired with the AI.
[01:12:32]
Right.
[01:12:33]
That's, that's the direction I think things are going.
[01:12:35]
Just like tell it very high level instructions.
[01:12:39]
But every time you give instructions, you, there's, there's some bias, right?
[01:12:44]
So at least so far the, the AI is, they're always very confident.
[01:12:48]
Exactly.
[01:12:49]
Which is problematic when they're actually wrong.
[01:12:53]
But they're also never going to say no.
[01:12:56]
Well unless you ask for things that's been trained to say no to.
[01:13:00]
Right.
[01:13:01]
Yeah.
[01:13:02]
I've seen a lot of people in the Elm Slack ask for questions like, how do I do X or how
[01:13:06]
do I do, how do I solve this problem?
[01:13:09]
And there's often that XY problem.
[01:13:12]
Like you ask to solve it.
[01:13:13]
Exactly.
[01:13:14]
You asked a solution to X, but you're actually trying to solve a different Y problem.
[01:13:19]
And so even if I imagine that the AIs will become extremely, extremely good, like 100
[01:13:28]
times better than you and me combined, or there's still only going to solve the problem
[01:13:33]
that you're asking them to.
[01:13:35]
Just like, let's imagine it's the smartest person on the world that you have free access
[01:13:40]
to.
[01:13:41]
Well, if you ask them something and they don't know, they don't think about whether you're
[01:13:46]
going to, whether it makes sense to ask the question, then they're not going to tell you.
[01:13:52]
Exactly.
[01:13:53]
So you need to prompt them, but you also need to think about how you ask the question, what
[01:13:59]
question you ask.
[01:14:00]
And I'm thinking maybe we should ask them as well.
[01:14:04]
Like, Hey, I have this feature that I want to do.
[01:14:08]
So can you tell me how I transform this HTML to a string?
[01:14:12]
And maybe you should also ask, like, does this make sense by the way?
[01:14:15]
Because then they start asking, answering that question.
[01:14:19]
Well, that no, that doesn't make sense.
[01:14:22]
So I said, we're good at gathering requirements, but we're not very good at those, but that
[01:14:29]
is our job.
[01:14:30]
And I think it will increasingly become our job.
[01:14:34]
So we're going to become AI managers.
[01:14:36]
Yeah.
[01:14:37]
Basically.
[01:14:38]
I think that's a good way to look at it.
[01:14:39]
Yeah.
[01:14:40]
AI product owners.
[01:14:41]
Yeah, totally.
[01:14:42]
Totally.
[01:14:43]
Yeah.
[01:14:44]
I think, and what you're talking about, the word that's been coming to mind for me is that
[01:14:50]
these AI engines are very suggestible.
[01:14:54]
Like if you say, I don't know, where might I have lost my keys?
[01:15:03]
Hint, I often forget them in my pants that I put in the hamper.
[01:15:11]
Then it's going to be like, are they in the hamper?
[01:15:14]
But it's going to run with, I've seen that with the Elm compiler sometimes says, hint,
[01:15:23]
and it tells it, maybe you need to do this.
[01:15:25]
And then it's like, okay, sure, let me try.
[01:15:28]
And it gets fixated on this one path that the compiler sort of hinted at, and that's
[01:15:34]
not a good path.
[01:15:35]
So that's why with this type puzzle, I was trying to give it a very clear set of rules
[01:15:41]
and say, this is the set of steps you're following.
[01:15:46]
And then even teach it, this is how you adjust if you are incorrect in one of your guesses.
[01:15:51]
And so you really have to prime it and prevent it from getting fixated and biased in one
[01:15:56]
direction.
[01:15:57]
Yeah.
[01:15:58]
But you also said some guardrails and if you were wrong in sending those guardrails, that's
[01:16:04]
going to be a long problem for you.
[01:16:06]
Oh yeah, absolutely.
[01:16:08]
And it is, I mean, these AI engines are also, they're interesting for ideation as well.
[01:16:13]
So there, I mean, that's a whole nother topic we could get into, but.
[01:16:18]
We mostly talked about using it for things that we know well, and that we can validate,
[01:16:23]
verify, which I completely agree is probably the way to use it.
[01:16:29]
But it is also very good at helping you out when you don't know something.
[01:16:33]
And there it becomes a lot more dangerous because it's overconfident and it's going
[01:16:38]
to lead you to wrong results, wrong paths, and you're not going to be able to figure
[01:16:44]
those out.
[01:16:45]
But because it knows a lot more than you, it will, I think in a lot of cases, be used
[01:16:52]
in that way.
[01:16:53]
And there people have to weigh in the risks that are involved.
[01:16:59]
Right.
[01:17:00]
So definitely in some cases, it's going to be amazing.
[01:17:04]
For instance, I am not a good drawer, but I can ask an AI to draw something for me.
[01:17:12]
I actually do have a whole website filled with drawings, but I probably shouldn't train
[01:17:17]
it on that.
[01:17:19]
But yeah, if I ask the AI to do it, then that would probably give some better results.
[01:17:26]
But when it comes to code, if I can verify it, then it's better.
[01:17:31]
If I can't verify it, then it's something new to me.
[01:17:33]
Well, that is very interesting as well.
[01:17:36]
And the thing that I'm worried here about on that matter is that if I ask the tool to
[01:17:42]
do something for me for something that I don't know, whether I will start over relying on
[01:17:47]
it instead of learning properly and improving my own skill sets.
[01:17:53]
I think that's going to happen a lot with a lot of people getting into development right
[01:17:57]
now.
[01:17:58]
And yeah, I think being an experienced developer, it's a lot easier to know what to rely on
[01:18:04]
it for or when it's maybe like starting to write code where you're not learning to write
[01:18:14]
a reg x.
[01:18:15]
And you probably should sort of figure that out instead of just blindly trusting a thing.
[01:18:19]
Or maybe it's okay to just be like, if the test passes, I don't really care how it arrived
[01:18:25]
at that.
[01:18:26]
Maybe that's okay too.
[01:18:27]
You know, but yeah, I can for instance, imagine a backend developer who knows a little bit
[01:18:32]
of Elm and they just ask the AI to generate the UI for their application or at least the
[01:18:39]
view parts of the application.
[01:18:43]
And that's going to be very helpful to get started.
[01:18:46]
But how do you make sure that things are correct with accessibility and all those concerns
[01:18:52]
that you don't know about?
[01:18:54]
Right, exactly.
[01:18:56]
Is it going to fit well with a design system you set up?
[01:19:00]
And there are all these assumptions that, yeah, so you have to know what to rely on
[01:19:04]
it for.
[01:19:05]
And if it's like, if you can have it perform a high level task that you can fully verify
[01:19:12]
and trust it for, that's interesting.
[01:19:14]
If you can have it help you with ideation and generating a list of things to think about,
[01:19:22]
and that's input for you to consider some other things, that's also very good.
[01:19:26]
Because that, if something is helping you with ideation, you can filter out a little
[01:19:31]
bit of junk to get the diamond in the rough.
[01:19:34]
Oh, this one idea, I didn't consider that.
[01:19:36]
And that was really good.
[01:19:37]
So that's another use case.
[01:19:38]
But the sort of in-between space where you just YOLO it and blindly incorporate it into
[01:19:45]
your code, I'm honestly pretty skeptical of the utility of that.
[01:19:51]
And I'm skeptical of how maintainable it's going to be working with systems like that
[01:19:56]
and maintaining code where there's a lot of that happening.
[01:19:59]
I think it's going to be okay for things that you're okay with throwing away.
[01:20:04]
Well, that you're okay with and that you can throw away.
[01:20:08]
Yeah, yeah, right.
[01:20:09]
Yeah, if you can scope something down really narrowly.
[01:20:12]
I used it the other day for writing something to traverse a directory structure to find
[01:20:21]
the root Elm project by looking until it found an Elm.json file.
[01:20:26]
For my Elm pages scripts, I changed it so you can do Elm pages run and then give a file
[01:20:31]
path and it will find the nearest Elm.json to the file you pass in.
[01:20:36]
And I wrote it with GPT-4 and I went through a few iterations and I guided it very clearly
[01:20:43]
with what I wanted in the result.
[01:20:46]
But I knew it was like, this is going to generate one function for me that if it works, I can
[01:20:52]
just let it do its thing.
[01:20:54]
Although I didn't like the style it used.
[01:20:56]
So I told it, instead of doing a bunch of for loops and while loops, can you do it using
[01:21:03]
functional style mapping and recursive functions?
[01:21:06]
And it modified it.
[01:21:08]
And then I said, can you use ESM imports instead?
[01:21:11]
And with a few tweaks, I had it refactor it to the style I wanted.
[01:21:14]
And so yeah, it was like a constrained thing.
[01:21:18]
And the next time you do that, you will prime it with, oh, use a functional style and use
[01:21:23]
ESM, etc.
[01:21:25]
Right.
[01:21:26]
And that was like a constrained enough thing that I know with my experience, that it's
[01:21:33]
like an independent, separable problem that if it writes a function that does this, I
[01:21:39]
can use that and it can be useful to my workflow.
[01:21:41]
So I think there's an art to knowing when to rely on it as well.
[01:21:45]
I feel like we have a lot more to talk about, a lot of interesting aspects to cover, but
[01:21:52]
this has already been a quite long episode.
[01:21:55]
Yes.
[01:21:56]
So I think we're going to cut it here.
[01:21:58]
Maybe we'll come back to this topic in a few months.
[01:22:01]
Who knows?
[01:22:02]
Let us know if you like it and if you want more of it.
[01:22:05]
Yeah.
[01:22:06]
And tell us what you've been doing with Element AI or pure functional programming and AI.
[01:22:12]
We would love to hear from you.
[01:22:13]
We'd love to hear what clever things you come up with or just how you use it in your workflow
[01:22:17]
and let us know what you want to hear about with Element AI in the future.
[01:22:22]
Did you prompt the audience well enough so that they give you the answers that you're
[01:22:27]
looking for or do you need to rephrase it slightly?
[01:22:30]
Maybe let's give them some guardrails.
[01:22:32]
Give us your example use cases.
[01:22:35]
Give us an example of the problem you used with it.
[01:22:38]
There we go.
[01:22:39]
I think we're good.
[01:22:40]
Don't give us ideas if you think they're bad.
[01:22:42]
Okay, that should be it, I think.
[01:22:47]
Perfect.
[01:22:48]
Well, Jeroen, until next time.
[01:22:50]
Until next time.