spotifyovercastrssapple-podcasts

elm-book with Georges Boris

Georges Boris joins us to discuss elm-book and how it helps iterate on a design language of Elm widgets.
May 9, 2022
#56

Transcript

[00:00:00]
Hello, Jeroen.
[00:00:01]
Hello, Dillon.
[00:00:02]
And today we've got a guest joining us, Georges Borie.
[00:00:07]
Thank you so much for joining us, Georges.
[00:00:08]
Thank you.
[00:00:09]
I'm really, really glad to be here.
[00:00:11]
Yeah, we're very glad to have you.
[00:00:13]
And today we're going to be talking with Georges about Elmbook.
[00:00:17]
So before we dive in, Georges, do you want to just give a quick intro to what Elmbook
[00:00:22]
is?
[00:00:23]
Sure.
[00:00:24]
Elmbook is an application as library.
[00:00:27]
So it's a library that kind of like wraps your visual components.
[00:00:31]
And you can use it to build rich documentation and also to build like a storybook like applications
[00:00:38]
for your UI stuff, basically.
[00:00:41]
Okay.
[00:00:42]
What is a storybook like application in your mind?
[00:00:46]
Yeah.
[00:00:47]
This is kind of like interesting.
[00:00:49]
I started using this thing called storybook, which is completely ubiquitous.
[00:00:54]
Yeah.
[00:00:55]
Can you define what storybook is?
[00:00:56]
Sure.
[00:00:57]
Because maybe not everyone knows.
[00:00:59]
Yeah, definitely.
[00:01:00]
So storybook is this library that automatically generates an application that you can inspect
[00:01:08]
a lot of your UI components.
[00:01:10]
You can see them in different states.
[00:01:11]
You can like use that for developing components in isolation and just do a lot of testing
[00:01:18]
instead of like actually going down your application and clicking everywhere until you find your
[00:01:23]
component and you find the edge case.
[00:01:26]
You can actually kind of like showcase all of your different use cases for something.
[00:01:32]
And that can be used for a whole lot of things, right?
[00:01:34]
It's a really good common ground for designers and developers to discuss things.
[00:01:39]
All right.
[00:01:40]
So in the storybook is a JavaScript tool or for JavaScript?
[00:01:44]
Yeah, it started being like a React specific thing, but then it grew.
[00:01:49]
And these days, you can use it with pretty much anything that is not Elm.
[00:01:54]
That's oddly specific.
[00:01:56]
Yeah.
[00:01:57]
Oh, to be honest, like I've heard Matthew Griffith, I feel like they use storybook with
[00:02:05]
Elm as well.
[00:02:06]
So it's possible, but it's not that common, basically.
[00:02:12]
But then again, I used to work in a lot of different technologies.
[00:02:18]
So Dart and like React Native and other stuff.
[00:02:21]
And I've always seen people trying to replicate storybook as this.
[00:02:29]
So it became like a really poor man's storybook in all those different languages.
[00:02:35]
And I didn't want to do that in Elm.
[00:02:37]
So I've listened to Teresa say this once, like instead of trying to replicate the tree
[00:02:43]
for visualizations, she wanted to do something that was really unique and was special, like
[00:02:49]
in Elm's way.
[00:02:51]
And this was what drove me to think about this type of use case from scratch.
[00:02:57]
And at the same time, I just started using Elixir for work.
[00:03:01]
And the Elixir and the whole Beam ecosystem, they use something called Xdocs, which is
[00:03:07]
this automatically generated documentation library website.
[00:03:12]
For anyone looking it up, that's H E X.
[00:03:15]
Yes.
[00:03:16]
Hexdocs with an H.
[00:03:19]
And I really loved it.
[00:03:20]
So everything was automatically...
[00:03:22]
I feel like since the whole ecosystem had this documentation thing ready for them,
[00:03:31]
it really entices everyone to be really good in creating documentations.
[00:03:36]
They can only focus on content and not getting the whole...
[00:03:41]
Like the whole...
[00:03:42]
How do I say it?
[00:03:44]
Like rubber...
[00:03:45]
I forgot the name.
[00:03:47]
They don't get sidetracked into building the foundation and they can just focus on getting
[00:03:51]
the actual content done.
[00:03:53]
Bike shading?
[00:03:54]
Bike shading.
[00:03:55]
Thank you.
[00:03:56]
Okay.
[00:03:57]
Yeah.
[00:03:58]
There's rubber...
[00:03:59]
Yeah.
[00:04:00]
Shaving.
[00:04:01]
Yeah.
[00:04:02]
Shaving.
[00:04:03]
All of that.
[00:04:04]
I feel like we have the same thing in Elm where we have the packages that have their
[00:04:09]
documentation generated from the function and module documentations.
[00:04:17]
Do you feel like the Hexdocs system is better or does it have additional things that Elm
[00:04:24]
doesn't have?
[00:04:25]
I'm just curious.
[00:04:26]
Or is it a similar experience?
[00:04:28]
It's sort of similar, but they actually have...
[00:04:31]
They separate two different things.
[00:04:33]
One is function documentation and one of them is actually guides.
[00:04:37]
So you can actually host your guides inside your package documentation website.
[00:04:43]
You can access the two things at the same time.
[00:04:45]
So you don't actually need to have your own library.com website to do the marketing and
[00:04:53]
everything else.
[00:04:54]
And you can actually...
[00:04:55]
If I'm not mistaken, you can actually team your documentation slightly.
[00:05:01]
So it feels like you are reading, I don't know, like Ecto's library instead of like
[00:05:08]
Phoenix library.
[00:05:09]
The branding is different.
[00:05:11]
So I don't know, I feel like Elm's documentation culture is already really, really good.
[00:05:19]
Exactly because you just mentioned.
[00:05:21]
The whole Elm packages are automatically generated.
[00:05:24]
The whole Sim version enforcement that the compiler does.
[00:05:30]
But then again, I feel like there was room for...
[00:05:34]
I'm not calling it improvement, but exploration basically.
[00:05:39]
And I tried to put together both the storybook interactive stuff.
[00:05:43]
And you can have snapshots that you are interacting with or just showcasing different states of
[00:05:48]
things.
[00:05:49]
Or you can have actual guides and just use plain markdown and it already outputs into
[00:05:55]
something that is visually pleasing.
[00:05:58]
And you can mix them both.
[00:05:59]
So this is something that Xdocs does not have as well.
[00:06:04]
So Xdoc is pretty much static.
[00:06:06]
And in Elmbook, you can actually have this guide and suddenly there is an Elm component
[00:06:12]
that it can be whatever.
[00:06:13]
So there is this language called leaflink, if I'm not mistaken, that actually used Elmbook
[00:06:21]
to host our documentation.
[00:06:22]
And there is this small REPL where you can just...
[00:06:26]
And it's just built with Elmbook and it's interactive layer.
[00:06:29]
Awesome.
[00:06:30]
We'll drop a link there and show notes.
[00:06:32]
That's very cool.
[00:06:33]
I've been...I've thought about this a lot with the package documentation in Elm.
[00:06:40]
My personal experience has definitely been that I feel more confident figuring out how
[00:06:46]
to write code by navigating Elm documentation than any other ecosystem I've been in.
[00:06:52]
Like so many ecosystems, maybe you'll find something that automatically generates a placeholder
[00:06:59]
for every function.
[00:07:00]
But then you look at it and you're like, well, wait, but how do I use this and why would
[00:07:04]
I use this?
[00:07:05]
And you can't tell if it's like a low level building block or a function you should use
[00:07:11]
and it doesn't often have examples.
[00:07:14]
And the culture around that in the Elm ecosystem is amazing.
[00:07:17]
And largely, it's both an ethos that the tone is set by maybe people who build some really
[00:07:25]
high quality packages early on and people sort of promoting these things.
[00:07:30]
And then it's the tooling.
[00:07:31]
The tooling gives you these great tools for automatically having...you have to have documentation
[00:07:37]
for every type and every function.
[00:07:40]
You can easily include example code.
[00:07:43]
You have tools like Elm verify examples, which is really beneficial.
[00:07:47]
But then, you know, and I've done some Elixir programming and I definitely have noticed
[00:07:54]
that it is very common that you'll see guides.
[00:07:57]
And in Elm, that's not very common.
[00:07:59]
You don't see guides.
[00:08:00]
You see amazing package documentation for each function and type in the API, but you
[00:08:06]
don't see guides as often.
[00:08:08]
Like you go and look at the Elixir absinthe GraphQL API and go to the hex documentation.
[00:08:16]
And it's a guide with like 50 different pages and grouped in these different categories.
[00:08:21]
And it's telling you how do you set up custom scalers.
[00:08:25]
And it's like a full on guide.
[00:08:26]
It's not just telling you how to use these low level functions.
[00:08:29]
So I have a hard time figuring out whether you say that in praise or as a bad thing.
[00:08:38]
I mean, you can find what you're looking for, for all these use cases.
[00:08:43]
And sometimes I feel like maybe we substitute those sorts of guides with just ask about
[00:08:51]
it on Slack.
[00:08:52]
There's not as much of an ethos as like, because package documentation is like, here's a function
[00:08:57]
or a type.
[00:08:58]
How do I use it?
[00:08:59]
But then what about I'm trying to solve this problem.
[00:09:02]
I have this use case.
[00:09:04]
How do I use this package to help me do that?
[00:09:07]
And that's not in our ethos quite as much to write full featured guides for that.
[00:09:10]
It takes a lot of work, but also we don't have the tooling for that.
[00:09:15]
So, yeah, it does feel like having a guide next to your API.
[00:09:21]
That does sound very good.
[00:09:23]
I think like what we do in the Elm communities use the ad docs and place them in the right
[00:09:29]
location so that you can write a story or write a guide or go from easiest to hardest
[00:09:36]
to simplest or more advanced in a way that is easy to understand.
[00:09:41]
But a guide next to it could be very, very helpful as well.
[00:09:45]
Yeah.
[00:09:46]
I feel like there is a kind of trap that you may fall into, which is when you have an actual
[00:09:52]
guide, sometimes you get a little too much.
[00:09:55]
You expect everything from it.
[00:09:57]
And you don't actually go to function definitions and try to piece the types out.
[00:10:02]
So in the hex, like the hex docs, the Elixir community, I feel like when something is not
[00:10:08]
documented in the guide, it's usually a lot harder to understand because everything is
[00:10:13]
dynamic.
[00:10:14]
There are types, but not the best types.
[00:10:19]
And even for Elmbook, I felt like since I do have the Elmbook guide, people usually
[00:10:25]
forget that there is also a package like Elmbook site that they can go through and just take
[00:10:32]
a look at functions.
[00:10:33]
That's a perfect example.
[00:10:35]
It would be ideal if both of them live together, right?
[00:10:39]
Right.
[00:10:40]
Yeah.
[00:10:41]
So in the Elmbook website, which is located...
[00:10:45]
What is the URL again?
[00:10:46]
It's on a Netlify page, but it's linked to in the readme for Elmbook.
[00:10:51]
So you have a guide with a lot of chapters and you've got one of the chapters, which
[00:10:58]
is the API, which links to the package documentation.
[00:11:03]
And I agree that it's a bit weird because you go through the whole guide, you skip over
[00:11:08]
the API at some point and you don't know when to reach or when to read one or the other.
[00:11:15]
Like, should I read the whole guide first and then look at the API or should I look
[00:11:19]
at the API and then read the guide?
[00:11:22]
So you have both of them together, but they're also very separate in a way.
[00:11:28]
I kind of dream to be able to just compile an Elmbook that it takes your Elm package
[00:11:38]
documentation as part of it as well, because it should be fairly simple, you know?
[00:11:43]
Yeah.
[00:11:44]
You have the docs.json file.
[00:11:45]
Exactly.
[00:11:46]
Yeah.
[00:11:47]
And you're not using like markdown to just like output everything.
[00:11:50]
So it should be possible.
[00:11:52]
But this kind of like leads me to another goal of Elmbook, which is to be completely
[00:11:57]
an Elm package.
[00:11:59]
And that in only that, you know, because I've really wanted to people to not need to like
[00:12:05]
install an NPM package or change their workflow to use Elmbook.
[00:12:09]
I really wish that I could like live inside the Elm ecosystem with its limitations and
[00:12:14]
et cetera.
[00:12:15]
But there are a few annoying things because of that.
[00:12:17]
For instance, like a really annoying like small thing for me right now is that if people
[00:12:22]
change the teaming mode, like if you go to light to dark mode, there is no way for me
[00:12:28]
to persist that state, right?
[00:12:31]
Right.
[00:12:32]
Oh, yeah.
[00:12:33]
As a pure Elm package that doesn't have access to local storage or...
[00:12:37]
Yeah.
[00:12:38]
Maybe a way for me to stay in the Elm ecosystem, but still be able to give more would be leaning
[00:12:44]
more into code generation, right?
[00:12:47]
So then I could output stuff like similar to Elm SPA or something like that.
[00:12:52]
Because like I don't say on pages because I feel like on pages is kind of drifting a
[00:12:55]
little bit with the whole Emdera, like the V3, right?
[00:12:59]
Right, right.
[00:13:00]
Server rendering and LameJar.
[00:13:02]
Yeah, I mean, it definitely supports static site generation still, but it's that's not
[00:13:06]
the only thing it's for.
[00:13:07]
Yeah, exactly.
[00:13:09]
So anyway.
[00:13:10]
So you mentioned that Elm Book is an application or an application in a package or...
[00:13:19]
Yeah.
[00:13:20]
The package is to build an application, right?
[00:13:23]
And it's not to build a Elm reusable element.
[00:13:27]
Yes.
[00:13:28]
So if you use Elm Book, you necessarily get a program, you don't get a view, update, subscription
[00:13:34]
thing.
[00:13:36]
Maybe if you return that instead, then you can give more power to the user who can go
[00:13:43]
through code generation, who can have persistent storage of things, but they handle it themselves,
[00:13:51]
which is not as great an experience, but maybe you can provide both like an advanced setup
[00:13:56]
and the more simple built in setup that you have today.
[00:14:01]
Yeah, yeah, for sure.
[00:14:02]
Like this is one thing that I found interesting and I learned as I was doing it.
[00:14:08]
I'm trying to not change Elm Book that much right now because it's sitting on a V1 and
[00:14:14]
I'm doing a separate package.
[00:14:16]
I won't go into that much details, but it's called Elm Admin, which is the same idea.
[00:14:20]
It's kind of like this idea of creating an application, but the whole setup stuff is
[00:14:29]
built as a package, so you can just plug in and focus on your actual business domain instead
[00:14:35]
of the pipes.
[00:14:39]
One thing that I've learned while doing this new thing is that instead of trying to receive
[00:14:45]
just the views or anything like that, like I do with Elm Book, if I just really embrace
[00:14:51]
the Elm architecture and try to make it a full Elm architecture work and I can just
[00:14:59]
wrap it inside another Elm architecture, it enables a lot more for the user.
[00:15:04]
Elm Book is almost like that these days because people work...
[00:15:08]
I feel like this is kind of community driven.
[00:15:10]
When I first released, it tried to be like that, but I didn't notice all of the use cases
[00:15:17]
and people were asking me to do a few things, like to expose a few types, to expose a few
[00:15:21]
functions and these days, Elm Book, you can have pretty much your whole Elm application
[00:15:28]
there, but not as smoothly as I would want.
[00:15:32]
What I'm doing with this package is that you have your own one update function, one view,
[00:15:38]
one everything like you would have and it just handles routing and a lot of different
[00:15:44]
actions that you can use and I feel like Elm Book v2 would probably go into that direction
[00:15:49]
as well.
[00:15:50]
Yeah, that gives a lot more power to the user, I think.
[00:15:54]
I'm curious in an ideal world, when we were talking about that you should be able to include
[00:16:04]
examples in package documentation, is your vision that one day we would be able to embed
[00:16:12]
if we have a package for a date picker UI, that we would be able to embed interactive
[00:16:19]
examples where it actually runs that code and we can embed it like visual demos in the
[00:16:26]
package documentation in actual Elm package docs?
[00:16:29]
Would that be like a long term vision that maybe one day something like that would be
[00:16:33]
possible or would it be a separate thing that you deploy a separate site or how would that
[00:16:40]
work?
[00:16:41]
I would love for it to be more kind of like an ecosystem thing because even though I don't
[00:16:47]
want to, it creates a little bit of competition which I really don't want.
[00:16:53]
But then again, a few packages, they end up doing the two things like Elm visualization,
[00:16:59]
there's a website full of examples.
[00:17:02]
Elm Shards, you have that amazing website full of examples that it's super useful.
[00:17:06]
If I'm using Elm Shards, that tab is open.
[00:17:10]
So it would be awesome to just have all of that available to everyone.
[00:17:14]
And especially if they don't have to actually spend time thinking about how to make things
[00:17:21]
work and be kind of like appealing to the eye and those things, just focus on their
[00:17:26]
own library.
[00:17:27]
Yeah, I've thought about that before with Elm Review as well.
[00:17:31]
Would it make sense for Elm Review to have its own special package documentation tools
[00:17:37]
that you could show, this is what this review rule will flag, this is the diff output it
[00:17:43]
will present to you for a rule fix?
[00:17:46]
Yeah, that would be amazing.
[00:17:47]
Complicated maybe, but that would be good.
[00:17:50]
But the effect, that's one of the fascinating things is the ecosystem impact of these types
[00:17:56]
of things.
[00:17:57]
When you have these tools available, like the tools that we were given in the Elm ecosystem
[00:18:02]
for building package documentation have really created this flourishing ecosystem of really
[00:18:08]
high quality documentation.
[00:18:10]
And it has an interesting sort of high level effect when you create these useful tools.
[00:18:16]
I'm actually quite curious, if you take the example of Elm Review again, the examples
[00:18:20]
that I give in the rules documentation is usually like this code would be flagged and
[00:18:27]
this code would be not flagged.
[00:18:30]
And I don't explain what the error message would be, I don't explain where it would be
[00:18:36]
flagged.
[00:18:37]
Those would be cool things.
[00:18:38]
But I actually wonder, would it be useful for someone to know about that?
[00:18:43]
Because no one has ever requested that information in the documentation.
[00:18:47]
So I don't know if the documentation is enough as it is, or whether it's just a need that
[00:18:55]
no one has thought about.
[00:18:58]
It would be cool to have a more dynamic thing and to be able to showcase things.
[00:19:02]
But maybe this is good enough.
[00:19:03]
My hunch is that there's value to people seeing a concrete thing and that our minds are activated
[00:19:10]
in a different way when we see something real.
[00:19:13]
Like when you see a description of something, then you're like, okay, that could be interesting.
[00:19:18]
When you see a UI or a CLI error message or an Elm Review CLI message that's saying, here's
[00:19:25]
my proposed fix, would you like to change this?
[00:19:28]
Our brain does something different where it can connect to a concrete thing.
[00:19:32]
And I think there's value just to that.
[00:19:36]
The fixes would be cool.
[00:19:38]
The documentation for Elm Review Simplify would be so complex.
[00:19:46]
This definitely enables you to do a lot of yak shaving.
[00:19:54]
I hope that no one implements this, otherwise I have no life anymore.
[00:19:57]
No new projects will appear.
[00:20:01]
But then again, creating the playground for people to do stuff like that, it's always
[00:20:06]
pretty amazing when you see people do crazy stuff.
[00:20:10]
I would never imagine someone documenting their language using it.
[00:20:14]
Never.
[00:20:15]
And here it is.
[00:20:18]
Exactly.
[00:20:19]
With an actual REPL running the thing.
[00:20:21]
I'm curious, George, what were your motivations?
[00:20:25]
We talked a little bit about it, but can you just give a little background?
[00:20:29]
Because I know you're big on design.
[00:20:33]
That's an area of expertise for you.
[00:20:36]
I think you fit in that intersection of engineering and design, and you think about that a lot.
[00:20:43]
What were your motivations in creating this tool for presenting these UIs?
[00:20:48]
And what does your workflow look like?
[00:20:51]
Does every single UI widget that you build, does it go through this process and end up
[00:20:56]
on an Elm book page?
[00:21:00]
My motivation, basically, I feel like I wanted to build something in Elm.
[00:21:09]
Before doing anything in Elm, I used to do things in the storybook way.
[00:21:13]
I would create a storybook.
[00:21:15]
I would try to think about components in an isolated way.
[00:21:20]
Especially for other languages, side effects for languages, it's really useful to have
[00:21:24]
something that it will decouple your view layer from your logic layer.
[00:21:31]
It's a lot harder for someone to just, like, if it's a view component, it's a lot harder
[00:21:36]
for someone to put some crazy business logic inside it.
[00:21:40]
And storybook kind of, like, dinks into that.
[00:21:43]
Elm, that's already kind of like a given in a lot of ways, right?
[00:21:48]
But at the same time, I was used to it.
[00:21:50]
And thinking about visual functions and just, like, the arguments that they are receiving,
[00:21:57]
those things, it was just part of my workflow.
[00:22:00]
So I wanted to build something like that.
[00:22:02]
And it just kind of led to another, I believe.
[00:22:06]
That's really interesting.
[00:22:08]
Can you elaborate on that?
[00:22:10]
You said that storybook encourages people to think about components in an isolated way.
[00:22:16]
So you're saying in sort of, like, the React ecosystem, for example, is there sort of a
[00:22:20]
philosophy behind it that by testing your components that way, they don't have they're
[00:22:26]
not overly smart, they're more dumb rendering, pure view function type style?
[00:22:32]
Well, I'm a bit of a node school React folk.
[00:22:36]
I'm not anymore.
[00:22:38]
But I actually started using React when Redux was first announced.
[00:22:42]
And I kind of, like, really liked the whole approach.
[00:22:45]
And that eventually led me to Elm.
[00:22:47]
But as soon as Redux came out, there was also this idea of, like, components and containers.
[00:22:55]
I don't feel like people use that anymore.
[00:22:57]
But the whole idea is that you would decouple the visual thing from the smart component
[00:23:03]
that would only deal with the logic.
[00:23:05]
And from my perspective, that is a really good approach.
[00:23:10]
You can name it whatever you want.
[00:23:12]
But separating concerns is always a good thing.
[00:23:15]
So and for junior developers, I feel like this is especially useful, right?
[00:23:21]
Because if you are asking for them to build one specific thing here, and you give them
[00:23:27]
a storybook page, sorry, what?
[00:23:31]
A notebook page.
[00:23:35]
They are a lot more certain that what they need to do is more reusable and abstracted.
[00:23:42]
They are not relying on pure values that will just leak into the component.
[00:23:47]
You are creating clear separation that will need an API and et cetera.
[00:23:53]
So I was actually mentioning to you that I'm teaching Elm to designers at my company.
[00:23:59]
So using ElmBook is an awesome way of just giving them something that they can see something.
[00:24:09]
They can use everything that we have set up for our main application.
[00:24:13]
So we use Taowin, they can use Taowin inside of ElmBook.
[00:24:17]
And everything is kind of like everything feels the right way.
[00:24:20]
But then again, they are protected from the actual app and everything else, you know,
[00:24:25]
it would be different from using an le or the tri page on the Elm link, because then
[00:24:30]
we will not have all of this kind of like extra setup that we already created.
[00:24:34]
Yeah, you would also not have git versioning and stuff like that.
[00:24:38]
Exactly.
[00:24:39]
Which sounds useful.
[00:24:41]
Sometimes it's the best way to start, right?
[00:24:44]
Actually I have been using the Elm link tri page a lot to just like, okay, this is a small
[00:24:50]
workshop.
[00:24:51]
Let's just do this.
[00:24:52]
And it's pretty amazing.
[00:24:53]
Yeah.
[00:24:54]
Yeah, I can imagine how I haven't personally worked in a sort of workflow using a tool
[00:25:01]
like ElmBook or Storybook in the past.
[00:25:03]
But I can imagine that it does make you be more deliberate about creating a design system
[00:25:08]
and thinking about both things in isolation and then how they fit into the overall look
[00:25:14]
and feel.
[00:25:15]
So you don't just say like, oh, let's add a little more padding to this button.
[00:25:20]
It looks weird.
[00:25:21]
You say, what do our buttons look like in our application?
[00:25:23]
And what do you know, what does this widget look like?
[00:25:26]
And when when Yurin and I first started Elm Radio, I, you know, it was like this big open
[00:25:35]
canvas of what does the Elm Radio website and styling and logo and stuff look like.
[00:25:40]
And I used Figma for the first time and that was really cool.
[00:25:45]
And that really helped me be like deliberate about like, at first I was trying to just
[00:25:51]
put together like an Elm pages page and it didn't look so nice.
[00:25:56]
And then when I started like being more deliberate and then I could like have a Figma mockup
[00:26:02]
and then say, what do you think of this Yurin?
[00:26:06]
And, you know, we'd go back and forth on it.
[00:26:08]
And that really helped being like deliberate about thinking about the look and feel rather
[00:26:12]
than just diving into code.
[00:26:14]
So I feel like there would be like a similar experience with this sort of design system
[00:26:18]
approach with Elm Book.
[00:26:19]
Yeah, definitely.
[00:26:20]
One thing that I noticed when I first joined, at least like it was how I felt.
[00:26:26]
It was that like the Elm community has a lot of flow, like a lot of packages to do with,
[00:26:32]
I don't know, complex data structures and like things that are more lower level.
[00:26:38]
But then again, when you go like the higher level, like I just want to get stuff done
[00:26:44]
and use the Elm architecture for the things that I really want to work on.
[00:26:49]
We don't get as much stuff like ready for to be picked off the shelf, right?
[00:26:54]
Yeah, like a select box or stuff like that.
[00:26:58]
Yes.
[00:26:59]
And not only that, right?
[00:27:00]
Like even the UI frameworks, because we do have like awesome stuff like Elm UI and Elm
[00:27:09]
CSS.
[00:27:10]
But those are, I will not call them UI frameworks in the sense of like reusable widgets, right?
[00:27:15]
Like they are more like structural.
[00:27:17]
Yeah, more like UI primitives.
[00:27:20]
Exactly.
[00:27:21]
Yeah.
[00:27:22]
And when you go to actual UI widgets, like collection of widgets, there are mostly translations
[00:27:29]
of things that are used outside of the Elm ecosystem.
[00:27:33]
And they sometimes require JS and they, it's like that I feel like this is an area worth
[00:27:39]
exploring as well, you know?
[00:27:40]
I don't know.
[00:27:41]
Like I feel like the whole make Elm a lot nicer for people to just like plug stuff with
[00:27:47]
the really awesome like logical tools that Elm give us.
[00:27:51]
This is something that maybe we could use.
[00:27:54]
Do you think that Elm lends itself to that or like how much of the state of sort of UI
[00:28:02]
widgets in the Elm ecosystem is because of like the size of the Elm community slash the,
[00:28:09]
you know, maybe number of people who gravitate towards it because they like thinking about
[00:28:14]
data structures more than nice designs?
[00:28:17]
I think I fall into that category perhaps, but versus how much of it is because some
[00:28:24]
sort of UI widgets want to be, have self encapsulated state and maybe something like a web component
[00:28:30]
would be a better fit for a date picker or something like that.
[00:28:34]
I feel like both.
[00:28:35]
I don't know.
[00:28:37]
I haven't seen yet a lot of designers in the Elm community.
[00:28:41]
When I started by taking a look at the whole like Elm cones videos on YouTube, et cetera,
[00:28:47]
and I thought that it was like a really plural community.
[00:28:50]
And it is like people like we have tons of different niches that people are really diving
[00:28:57]
into.
[00:28:58]
But design, I don't feel like it's the like one of the bigger ones.
[00:29:02]
So at the same time, you are totally right, Dillon.
[00:29:06]
Like sometimes UI tends to, they could use like internal state for something that is
[00:29:12]
really complex, like a date picker or something like that.
[00:29:15]
And it's really hard.
[00:29:17]
I think it's really hard to both create something that is isolated enough to be like placed
[00:29:24]
as a package, but at the same time customizable enough that you can kind of like make it your
[00:29:31]
own and fit your use case.
[00:29:33]
Like those things are rarely something that you can just like plug and play and they output
[00:29:37]
exactly what you want.
[00:29:39]
Or even the look and feel sometimes is not what you want.
[00:29:42]
So those things are kind of like harder to get right.
[00:29:46]
Yeah, especially when you have a designer on your team and your designer says, oh, well,
[00:29:50]
we should have a date picker and it should look like this.
[00:29:54]
Or you're like, well, I can find a date picker on the Elm or the NPM package registry, depending
[00:30:01]
on the language you're working with, but it's not going to look like that.
[00:30:06]
I can try it, but it's going to be very hard.
[00:30:10]
Oh, and then it's missing a feature or there's some additional feature that we absolutely
[00:30:16]
don't want.
[00:30:17]
It's very, very hard to get things exactly right for everyone.
[00:30:23]
And that's why I feel like in Elm people just tend to re implement themselves.
[00:30:29]
And I think that ends up being for the better in practice.
[00:30:34]
But yeah, maybe you're right.
[00:30:35]
It's just we have a lack of people who are interested in designing and publishing UI
[00:30:41]
elements.
[00:30:42]
Yeah, but then again, I'm totally with you.
[00:30:46]
I feel like we tend to re implement everything again and again.
[00:30:50]
For better or worse.
[00:30:53]
But there are some things that are really hard to get right.
[00:30:55]
Like a date picker, whenever you're dealing with time, you try not to.
[00:31:02]
And if you take into consideration accessibility and everything else that goes along with it,
[00:31:08]
then there's no way.
[00:31:10]
So it would be awesome for us to either be closer to the custom elements community, if
[00:31:17]
there is one.
[00:31:18]
And at the same time, have something that is kind of like fills the gaps.
[00:31:24]
Because a lot of the times you don't need custom elements.
[00:31:27]
You can just have something that is more using the platform.
[00:31:31]
But then again, you need it.
[00:31:33]
I just listened to the episode.
[00:31:35]
So I'm kind of like, it's in my head.
[00:31:39]
So I don't know.
[00:31:42]
I feel like we could use both, probably.
[00:31:44]
I would love to see more widespread use of web components in the Elm community.
[00:31:50]
And I think, I mean, increasingly we're seeing, you know, very large sites are using it quite
[00:31:59]
a lot.
[00:32:00]
Like, YouTube uses web components a lot.
[00:32:03]
The Adobe Photoshop in the browser, from what I've heard, is built entirely out of web components.
[00:32:08]
And they're becoming more and more full featured and more widespread.
[00:32:13]
And it would be amazing to see a set of these sort of lower level UI widgets that have self
[00:32:20]
contained state.
[00:32:21]
Yeah, but they're not going to be published on the Elm package registry, though.
[00:32:25]
No.
[00:32:26]
So it's like maybe a lot of applications use web components, and we don't know.
[00:32:32]
It's just we won't see them in the packages.
[00:32:35]
Whereas in React, well, or in JavaScript land, then yeah, you can publish packages with web
[00:32:41]
components and you can figure out whether people use them a lot in that community.
[00:32:48]
You can tell that.
[00:32:49]
Right.
[00:32:50]
Yeah.
[00:32:51]
I'm not saying it's used a lot.
[00:32:53]
I'm just saying it's hard to tell.
[00:32:56]
That's right.
[00:32:57]
Well, shameless plug here.
[00:32:58]
I'm actually muting one thing here.
[00:33:04]
I'm muting those two things, right?
[00:33:06]
Elm admin and Elm widgets, which is kind of like proposes itself to be kind of like that.
[00:33:12]
But I'm avoiding as much as I can to use any internal state because it gets harder to integrate,
[00:33:22]
even if it's a little bit.
[00:33:24]
And I'm going to focus on everything that I can do without custom state, basically.
[00:33:29]
And then maybe something like that could point to, okay, but you do need a dick picker.
[00:33:35]
If I do have something like if I'm using Elm book as a guide for the thing, I can actually
[00:33:39]
have guides that point to other stuff in the community and not just the same package that
[00:33:44]
you are using.
[00:33:45]
I don't know.
[00:33:46]
Doing things in this way, just like establishing the boundaries that you're trying to solve
[00:33:52]
and be really explicit about the things that are outside of the boundary, it makes sense
[00:33:57]
as well, right?
[00:33:58]
For the Elm community as a whole.
[00:33:59]
Yeah, it is also interesting how when you have vanilla Elm HTML and Elm UI and Elm CSS
[00:34:08]
and even other sort of less popular approaches are out there.
[00:34:15]
And in React or Svelte, it's just like JSX or HTML templates.
[00:34:23]
That's what you work with.
[00:34:24]
You don't have this abstraction over those types.
[00:34:28]
And whereas in Elm, we have the element type in Elm UI and the styled HTML types.
[00:34:37]
We have the virtual DOM.
[00:34:39]
That is primitive.
[00:34:40]
At the end of the day, it needs to turn into that.
[00:34:43]
But you can be using these building blocks that are a wrapped version.
[00:34:47]
And then at the very end, it's turned into that virtual DOM building block, which everything
[00:34:52]
turns into that if it's going to be HTML on the page.
[00:34:55]
But it does make it harder to intermix things that use these different tools.
[00:35:02]
And I wonder if that is a source of fragmentation that other ecosystems don't have to work with
[00:35:08]
in the same way.
[00:35:09]
In the React ecosystem, they have a lot of fragmentation with state management, the state
[00:35:13]
management layer.
[00:35:14]
I wonder if we have similar fragmentation in our UI layer.
[00:35:19]
To be honest, in the React world, it's kind of like a false sense that you can just plug
[00:35:25]
and play everything.
[00:35:26]
Because in practice, things work really differently from each other.
[00:35:30]
Sometimes they are not really compatible.
[00:35:31]
When you want to plug things into each other, then it becomes like a mess.
[00:35:36]
I'm not sure.
[00:35:37]
I feel like sometimes we see NPM with...
[00:35:39]
I was just taking a look at Sorrybook, for instance.
[00:35:42]
They have 16.5 million downloads a month and like 1400 contributors.
[00:35:51]
So then...
[00:35:52]
Wow.
[00:35:53]
So it's kind of hard for us to take a look at that and not feel like, okay, it must be
[00:35:59]
amazing.
[00:36:01]
But then again, when you are actually using it and feeling the pains and trying to make
[00:36:05]
things work together, it's not as nice.
[00:36:10]
And sometimes it's not possible as well, but at least it's more visible.
[00:36:16]
The boundary layers are really visible.
[00:36:19]
When you are using LMSSS and you want to use LMIUI inside it, you can.
[00:36:24]
You can just translate to HTML and then back to something else.
[00:36:28]
But then again, sometimes by doing that, you are making your application a lot slower because
[00:36:32]
you are creating the same styles over and over again.
[00:36:37]
Foot guns everywhere, basically.
[00:36:39]
Yeah.
[00:36:40]
I mean, the composability problem is always challenging.
[00:36:45]
How do you create a way to solve a problem and how does it compose with other ways to
[00:36:49]
solve the problem that might be operating at a similar level?
[00:36:54]
They don't necessarily fit together neatly.
[00:36:56]
It's hard to design things that way.
[00:36:58]
So would you use virtual DOM as the primitive if you were to build a UI package?
[00:37:06]
Because that is the easiest to...
[00:37:08]
And the most lightweight as well, way to create a UI package.
[00:37:14]
You're not adding LMSSS or you're not adding LMIUI, a lot of code that maybe wouldn't be
[00:37:19]
in there otherwise in your application.
[00:37:22]
Yeah.
[00:37:23]
Exactly that.
[00:37:25]
It's funny because maybe I'm doing something that is awful.
[00:37:30]
I hope not.
[00:37:32]
But I'm going really old style in the styling of those three things, the widgets, admin
[00:37:39]
and elm book.
[00:37:40]
Because I don't know, a few years ago, you had global CSS and it kind of worked in some
[00:37:50]
ways as well.
[00:37:51]
People managed.
[00:37:53]
You do not have to have a hash for every class that you are using in those things.
[00:37:59]
So I'm actually using standard CSS with all of those.
[00:38:05]
And I'm compiling them to a single node with styles that I want to use.
[00:38:11]
And if you do it right, it becomes a really small bundle and it works.
[00:38:17]
And you can just avoid name clashes by doing your own prefixing and then using something
[00:38:24]
like Banner or something like that.
[00:38:26]
And perhaps there will be another person that is using the same prefix and then things will
[00:38:32]
go wrong.
[00:38:33]
I totally forgot about the issue with CSS.
[00:38:38]
That's a problem.
[00:38:39]
Yeah.
[00:38:40]
For Elm book, for instance, I don't have any CSS reset.
[00:38:45]
In any of them.
[00:38:46]
Because if I do, well, what Storybook does, for instance, it creates an iframe so that
[00:38:53]
you can have your own component.
[00:38:56]
There's advantages.
[00:38:57]
You can have all of your styles only on that component.
[00:39:01]
You can actually mock different screen sizes, triggering actual mobile responsiveness settings.
[00:39:11]
It's harder for me to do that without relying on iframes on Elm book.
[00:39:15]
So what I'm doing is just like I'm styling in the more specific way possible each of
[00:39:21]
the elements that are part of Elm book.
[00:39:23]
And if someone says, like, okay, this is kind of broken, I just go there and battle test
[00:39:29]
the whole approach.
[00:39:31]
And sometimes it has been working pretty okay, at least.
[00:39:34]
Maybe the iframe solution would even work, right?
[00:39:37]
Because I could be hosting the same Elm book, like an internal URL, and then just displaying
[00:39:43]
the iframe for that URL of the same application and making things work in that way as well.
[00:39:49]
If you have control over the DOM because you use an HTML file, then maybe you can inject
[00:39:55]
the application inside a shadow DOM.
[00:39:59]
You don't know if you can do that through Elm.
[00:40:02]
Don't think so.
[00:40:03]
No, you need JavaScript to create a shadow DOM.
[00:40:05]
Yeah.
[00:40:06]
Iframes, as far as I know, they don't share styles, right?
[00:40:10]
Like at all.
[00:40:11]
I have no clue.
[00:40:12]
You tell me.
[00:40:13]
Yeah.
[00:40:14]
They don't.
[00:40:15]
Like it's basically a window to another.
[00:40:18]
I was even reading that it spins up a different...
[00:40:21]
It's kind of like a different tab in your browser, but you're just looking at it.
[00:40:26]
So it takes twice the resources and those things, all of the amazing things that you
[00:40:32]
can expect.
[00:40:33]
Great.
[00:40:34]
Yeah.
[00:40:35]
But it's an internal tool, right?
[00:40:38]
This is the one thing, the challenges that I'm trying to tackle, at least in this application
[00:40:47]
as libraries, they don't need to be user focused, performance focused applications.
[00:40:53]
It can be kind of like internal tools.
[00:40:55]
They need to work, but it's fine if they are a bit of the heavy side and if they work well,
[00:41:01]
right?
[00:41:02]
Right.
[00:41:03]
Yeah.
[00:41:04]
Because there is...
[00:41:05]
I mean, one of my things that I spend a lot of time thinking about is avoiding running
[00:41:13]
markdown parsing and syntax highlight parsing in the client.
[00:41:19]
But to do that, I've thought a lot about how to use Elm pages to sort of do that pre processing
[00:41:27]
so it can send you the parse to mark down so that work doesn't have to happen in the
[00:41:32]
browser and same for syntax highlighting.
[00:41:34]
But you can sort of say, well, if a user is doing this on their mobile phone over a slow
[00:41:40]
3G network, maybe that's not ideal, but for internal tools, that's all right.
[00:41:46]
Yeah.
[00:41:47]
I hope so.
[00:41:48]
I don't know.
[00:41:50]
So I was noticing for the Elm UI, I believe you just do basic HTML rendering for the markdown
[00:41:58]
parsing and then you embed the components with Elm UI, but you don't change the render.
[00:42:05]
So when you do a custom renderer, you don't change the markdown rendering in Elm book.
[00:42:10]
Yeah, I don't.
[00:42:11]
Which makes sense.
[00:42:12]
Yeah.
[00:42:13]
Yeah.
[00:42:14]
It's only the components, right?
[00:42:15]
Right.
[00:42:16]
It's kind of in isolation of everything else.
[00:42:19]
Right.
[00:42:20]
Right.
[00:42:21]
Yeah.
[00:42:22]
So you don't have to have this heavyweight custom configuration where you're giving
[00:42:26]
a custom Elm markdown renderer for Elm UI if you use that.
[00:42:31]
Yeah.
[00:42:32]
Yeah.
[00:42:33]
For sure.
[00:42:34]
Maybe again, like maybe there are downsides for that, but I feel like that's okay for
[00:42:39]
an internal tool.
[00:42:40]
For instance, like there are possibly most definitely there are like duplicate styles
[00:42:45]
if you're using something like Elm CSS or Elm UI, but the duplicate styles are just
[00:42:51]
like extra weight in the HTML, right?
[00:42:53]
Like they are not really clashing with each other because you are using the same framework.
[00:42:57]
So that should be fine.
[00:42:59]
One thing that I was curious about your opinion on was, well, Elm book was my first Elm app
[00:43:06]
and also Elm library, right?
[00:43:08]
So coming from other ecosystems, I tried to replicate a few things on Elm book.
[00:43:15]
Like I feel like there is a lot more handholding in other ecosystems than in Elm when it comes
[00:43:22]
to just like using a package.
[00:43:24]
Do you mean through guides?
[00:43:25]
No, no, no.
[00:43:26]
No, I mean through kind of like helper functions instead of exposing the primitives that you
[00:43:31]
can create everything yourself.
[00:43:33]
I feel like in Elm it's pretty common to focus on primitives and kind of like explain how
[00:43:39]
would you roll your own something and then kind of like leave people to it.
[00:43:45]
And I actually asked a few people about Elm book and I got this response.
[00:43:49]
Like I don't know, I feel like there are too many helper functions and because I definitely
[00:43:56]
did that, like I feel like if I thought about our use case, it would be easier to do like
[00:44:01]
instead of everyone trying to like do this three steps, I just created a helper function
[00:44:05]
that did all of that.
[00:44:07]
But it should be possible by just like using this bare bones function, you know?
[00:44:11]
And I expose both.
[00:44:12]
And this is something that I'm kind of like struggling against right now.
[00:44:16]
I don't know if this is something that it's actually useful or if by doing that I'm actually
[00:44:21]
teaching people to expect everything to come from a helper function instead of like just
[00:44:26]
be creative and roll your own, you know?
[00:44:29]
Yeah, maybe.
[00:44:30]
I also feel like if you expose a lot of help functions or when you say help functions,
[00:44:36]
you mean one function that does the equivalent job of three functions composed in a specific
[00:44:42]
way, right?
[00:44:43]
Stuff like that.
[00:44:44]
So if you have a lot of combinations that are possible, you will have to add a lot of
[00:44:49]
helpers.
[00:44:51]
And maybe at some point people will say, hey, well, there's a helper for this and this and
[00:44:56]
this, but not for this.
[00:44:57]
Can you please add it?
[00:44:58]
Like, yeah, sure.
[00:45:00]
And also for a user, they have more APIs to know about and some of them may have like
[00:45:09]
some specific workings like, oh, this one renders this chapter or this element.
[00:45:16]
But with this slight modification that you might not expect, I feel like it's easier
[00:45:22]
for people to read something that is slightly longer, but that is common.
[00:45:27]
If they see the same functions over and over again, they get a good grasp of the API.
[00:45:33]
But if you have a lot of helpers for different situations and they use all of them, then
[00:45:39]
it's really hard to know which one to use and to know what something does if it's the
[00:45:44]
first time you encounter it.
[00:45:46]
Yeah.
[00:45:47]
Yeah.
[00:45:48]
Maybe it goes into the guide direction because like if you just provide the primitives, but
[00:45:54]
you have kind of like an awesome Elm, like, you know, like those examples, folders or
[00:46:01]
something like that, that people can just like actually provide ideas of how you can
[00:46:05]
use those things, then you are doing both, right?
[00:46:08]
Like you're providing the cleanest steps, the cleanest API, but then you are also showing
[00:46:14]
how to do the, how to actually create the helper function that you need and then make
[00:46:18]
it your own, right?
[00:46:20]
Yeah.
[00:46:21]
People can write those helper functions themselves.
[00:46:23]
Definitely.
[00:46:24]
Yeah.
[00:46:25]
One thing that it was like, I released Elm book with like a bug in two helper functions
[00:46:30]
and the fix would be a major change.
[00:46:36]
So I never fixed them.
[00:46:39]
I just like wrote like, dude, this is a helper function.
[00:46:43]
Just write this instead.
[00:46:44]
And then that's fine, you know?
[00:46:46]
But then again, they are wrong and they will still be wrong when you hear this, listen
[00:46:53]
to this.
[00:46:54]
Yeah.
[00:46:55]
But only two, I promise.
[00:46:57]
I don't know.
[00:46:58]
Maybe.
[00:46:59]
I mean, there is an Elm review rule for reporting deprecated, usages of deprecated things.
[00:47:07]
Maybe you can just market as deprecated and then people will not use them anymore if they
[00:47:12]
use that rule.
[00:47:13]
Hopefully.
[00:47:14]
Yeah.
[00:47:15]
Yeah.
[00:47:16]
But yeah, that's a very good reasons against a helper functions.
[00:47:19]
If you know that they have bugs, then don't write them.
[00:47:23]
There you go.
[00:47:25]
Lesson learned.
[00:47:26]
Lesson learned.
[00:47:27]
It is API design in Elm is fascinating because I have the feeling that more so than another
[00:47:36]
languages and ecosystems, Elm package authors really think very carefully about all possible
[00:47:44]
use cases and how to support them.
[00:47:46]
And I think that the Elm language to a certain extent is, it makes us be explicit about things
[00:47:51]
because for one thing, you have to be very explicit.
[00:47:54]
You have to be very explicit about what the types need to be and how many arguments something
[00:47:58]
takes and you can't just sort of fudge it or say whatever you can pass whatever in.
[00:48:04]
You have to be very thoughtful about what it's going to accept because the Elm language
[00:48:08]
requires that.
[00:48:09]
You can't say, oh, well now we have a new feature.
[00:48:12]
If the arguments of this existing function is now a Boolean, then it does that thing.
[00:48:19]
Exactly.
[00:48:20]
Yeah.
[00:48:21]
Like if something, if you pass in a list now, then it'll do this, but before it only accepted
[00:48:24]
a single item and it had this different behavior and you could pass in Nolan, it would do this
[00:48:28]
thing and in Elm you have to really think like, what do you want your API to be?
[00:48:32]
Because you're sort of putting the stamp, like setting it in stone to a certain extent
[00:48:37]
or making it a breaking change if you change it.
[00:48:40]
And now I have goosebumps because of the API.
[00:48:44]
It's a pretty intense experience to create Elm APIs because you have to think through
[00:48:48]
all these use cases very carefully and we try to make impossible states impossible.
[00:48:52]
So we try to like create all these types and APIs to avoid these things.
[00:48:57]
But yeah, as far as like helper.
[00:48:59]
And also we care about major versions because we have to.
[00:49:03]
Right.
[00:49:04]
So if you did the same thing in JavaScript, then you could just, oh, well, I'm just going
[00:49:08]
to remove this function or I'm going to change the way it's written.
[00:49:12]
Making a breaking change.
[00:49:13]
Yeah.
[00:49:14]
Just make a breaking change and do a patch version.
[00:49:19]
No one will notice.
[00:49:20]
Right.
[00:49:21]
We can't do that in Elm.
[00:49:23]
So we have to get more thoughtful or people will know that we have, that our version one
[00:49:28]
sucked.
[00:49:29]
Yes.
[00:49:30]
Yeah.
[00:49:31]
Well, one thing that I noticed that Teresa did with Elm shards was that she had the Elm
[00:49:37]
shards library and then there was like this shards or I don't know, like one other stuff,
[00:49:42]
one other library.
[00:49:43]
And the other one was kind of like version 18 or something like that.
[00:49:47]
20, I think now.
[00:49:48]
Yeah.
[00:49:49]
Like, I don't know.
[00:49:50]
It's crazy.
[00:49:51]
But I really liked the approach of it's still a valid use of the Elm packages.
[00:49:56]
If you have like an alpha version of your package that it just doesn't care about like
[00:50:01]
major versions and you can just like be completely crazy and then you stabilize and actually
[00:50:06]
create something that is more stable and ready to use.
[00:50:09]
So I actually talked to her about it.
[00:50:12]
Like, oh, I love the way that you are doing like the nightly releases.
[00:50:15]
And she was like, oh, likely releases.
[00:50:17]
And then this was like explained as night releases then, you know, and I'm seeing the
[00:50:23]
idea right now in everything I'm doing, like the whole, like the stuff that I mentioned
[00:50:27]
that they are already published, but all like alpha and please don't use them.
[00:50:33]
But then shortly, I hope they will be like actually released, you know?
[00:50:38]
Yeah.
[00:50:39]
Just a word of warning because it comes to mind.
[00:50:42]
If you have a package that depends on, let's say Elm charts and you want to switch, use
[00:50:48]
it and you want to switch to the alpha version.
[00:50:51]
So which was Teresa slash charts instead of Elm charts, then that's not going to work
[00:50:56]
because you're actually depending on the Elm charts package through the other package.
[00:51:03]
I don't know if that's clear.
[00:51:05]
No.
[00:51:08]
So if you use Elm charts extra, for instance, that depends on Elm charts, which locks you
[00:51:15]
into using Elm charts and it doesn't allow you to use Teresa slash charts.
[00:51:21]
Okay.
[00:51:22]
Got it.
[00:51:23]
Because of name clashes basically.
[00:51:26]
Because the Elm charts extra would depend on Elm charts.
[00:51:34]
You could depend on both, right?
[00:51:35]
In theory.
[00:51:36]
But then again, the names will be the same and you put them in the right way.
[00:51:39]
So the module names would be the same, so you couldn't use them together.
[00:51:42]
Right.
[00:51:43]
Right.
[00:51:44]
Right.
[00:51:45]
Right.
[00:51:46]
Yep.
[00:51:47]
That's true.
[00:51:48]
Yeah.
[00:51:49]
I'm just using the alpha stuff because I'm using them right now, but I really strongly
[00:51:51]
advise like don't use them.
[00:51:54]
But then again, it helps you to just like there's a doc there and you can test it in
[00:51:59]
a standard way than just like doing the whole like source directories, you know?
[00:52:07]
I like the source directories.
[00:52:09]
Okay.
[00:52:10]
I'm the only one.
[00:52:12]
Okay.
[00:52:13]
Got it.
[00:52:15]
It's fun for examples, but when you are trying to just like the whole Git sub module stuff
[00:52:20]
or...
[00:52:21]
Oh, yeah.
[00:52:22]
But that's alpha don't touch.
[00:52:24]
Yeah.
[00:52:25]
You should try the alpha package for the LN pages 3 alpha.
[00:52:29]
That would be helpful, actually.
[00:52:31]
Yeah.
[00:52:32]
For instance, like we in our company, we have like a shared package, but managing the dependencies
[00:52:38]
of it, like in everything, every time we start using it in other packages, we have to add
[00:52:45]
all of the indirect dependencies as well.
[00:52:46]
Like it's awful.
[00:52:47]
Awful.
[00:52:48]
But at the same time, I really didn't want to share like this internal package, the own
[00:52:54]
packages.
[00:52:55]
I know that a lot of companies do that.
[00:52:57]
Like NoraLink does that for the UI, right?
[00:53:01]
But I don't know.
[00:53:02]
Yeah.
[00:53:03]
I mean, it's annoying, but you can at least you can make it crash.
[00:53:10]
It's not like there's insecurity about doing it wrong.
[00:53:13]
It's just like you'll get competitive errors and you have to do manual stuff.
[00:53:17]
Yes.
[00:53:18]
Is it worth it?
[00:53:19]
I don't know.
[00:53:20]
No.
[00:53:21]
So you use Elmbook for writing your company's style guide, right?
[00:53:28]
Yes.
[00:53:29]
Do you have any recommendations on how to do it?
[00:53:34]
Like what are some things that are very important to know and to do for style guides that people
[00:53:40]
who have never written one should know about?
[00:53:44]
Sure.
[00:53:45]
Well, in my opinion, the best thing to do is to think of style guides as kind of like
[00:53:51]
a part of your test case for your visual components.
[00:53:55]
Because if you're using Elm, you have like the whole compiler and the type checking as
[00:53:59]
part of your tests.
[00:54:00]
So I usually have like a module for something.
[00:54:04]
I don't know, like an UI.button.
[00:54:07]
And inside that module, I will have my usual functions, but I also have like a docs function.
[00:54:12]
And the docs is just like the chapter for that particular piece of my UI.
[00:54:16]
And it sits together like in the same module.
[00:54:19]
It's really easy for me to like, if I change something that something breaks, I can just
[00:54:23]
like go to the docs and change it.
[00:54:25]
It's a really non isolated way of working.
[00:54:29]
And in Elm, this is completely fine, right?
[00:54:31]
Because like we have that elimination.
[00:54:34]
And if I'm not using the docs in production, I don't care.
[00:54:38]
I can just like expose them.
[00:54:40]
And it's docs, right?
[00:54:41]
Like people wouldn't get confused about like just using the docs for this here inside this
[00:54:46]
page like by mistake.
[00:54:49]
I hope they won't.
[00:54:50]
Instead, the docs will expose an Elm book chapter.
[00:54:54]
So even if they did, it's not compatible.
[00:54:57]
So this is something that I always do.
[00:54:59]
I have like one chapter per feed.
[00:55:02]
Because you're, we actually didn't talk about how Elm book works, but Elm book is a series
[00:55:07]
of chapters, basically, right?
[00:55:09]
And each chapter you put in some markdown and list of things you want to add to that.
[00:55:16]
Yeah.
[00:55:17]
Elm book is basically a group of chapters that you glue them to a book.
[00:55:23]
But inside the chapter, you can give any piece of like markdown you want and just like create
[00:55:29]
this guide.
[00:55:31]
Or you can give like a list of components.
[00:55:34]
They can be static.
[00:55:35]
So it's super simple to just like give it some HTML and that's fine.
[00:55:40]
Or they can be dynamic and you can receive a dynamic state.
[00:55:45]
They can use that state.
[00:55:46]
They can trigger messages.
[00:55:47]
They can like change and just like work as a normal Elm application.
[00:55:51]
And you can mix both things together, right?
[00:55:53]
So you can kind of like each chapter has a registry of components.
[00:55:59]
And you can like add components to that registry and then use them inside your markdown whenever
[00:56:05]
you want.
[00:56:06]
So you kind of like tag them with labels and then you can specify the labels inside the
[00:56:12]
markdown when you want to use them.
[00:56:13]
Yeah.
[00:56:14]
Yeah.
[00:56:15]
It's very cool that you made a sort of meta tool around Dillon Kern's Elm Markdown for
[00:56:21]
sort of using the HTML renderer to render these components.
[00:56:27]
It's very neat.
[00:56:28]
Very clever.
[00:56:29]
Yeah, definitely.
[00:56:30]
Thank you.
[00:56:31]
I have no idea how would I have done that without it?
[00:56:35]
Yeah.
[00:56:36]
I really like how you're basically able to abstract away all of the details of the fact
[00:56:44]
that it uses Dillon Kern's Elm Markdown.
[00:56:46]
So as far as the users are concerned, they don't define a markdown renderer or touch
[00:56:52]
that API at all directly.
[00:56:54]
But under the hood, it can say, well, let me define an HTML renderer.
[00:57:00]
So if you say, if you do a component tag and you say with label equals, then I'm going
[00:57:05]
to take that over and render there.
[00:57:08]
But the user doesn't have to ever interact with Elm Markdown directly.
[00:57:11]
Exactly.
[00:57:12]
Yeah, that's exactly it.
[00:57:13]
One thing that I really like, Elm is just functions, right?
[00:57:17]
And our views are also just functions that receive stuff.
[00:57:20]
There is an alternative in the ecosystem called Elm UI Explorer.
[00:57:25]
It's slightly different from Elmbook.
[00:57:27]
As far as I know, it relies on an NPM layer.
[00:57:32]
You have to run a init script.
[00:57:33]
I feel like you have to run the application through it as well.
[00:57:37]
But they provide knobs.
[00:57:40]
I don't know if you are used to that idea, but it's basically kind of like ready made
[00:57:45]
tools for you to mess with component props, basically.
[00:57:49]
So you specify, okay, this component takes a bool, a string, a color, a list of values.
[00:57:56]
And those knobs can act inside that component and you can interact with it without actually
[00:58:01]
specifying the whole interaction layer.
[00:58:04]
So this is something that I really hope that could be possible in Elmbook, even without
[00:58:09]
being the main library.
[00:58:11]
Because if you have a view and a way to interact with the state, you could possibly wrap that
[00:58:18]
view with whatever you want.
[00:58:20]
We could have a separate knobs library that could just be plugged on top of Elmbook.
[00:58:27]
But I don't know, maybe Jeroen has a similar opinion.
[00:58:32]
But you created Elm Review.
[00:58:34]
But at the same time, for it to make sense, you also created a whole bunch of Elm Review
[00:58:40]
rules, right?
[00:58:42]
So maybe this is something that I, okay, this is kind of pluggable.
[00:58:45]
But maybe I'm the one that needs to do the plug in as well, you know?
[00:58:50]
So the idea behind the Elm Review in this case was I'm going to write a rule.
[00:58:56]
People might not agree with it.
[00:58:57]
And I don't want it to be something that is considered to be core.
[00:59:02]
Because otherwise, other things should be considered core and I should write it.
[00:59:07]
And if it's not done right, then it's just not done right.
[00:59:11]
But if it's a plug in, people can fork it, can improve it, can publish it.
[00:59:17]
In practice, I did write my rules pretty good.
[00:59:20]
So they didn't fork it.
[00:59:23]
So maybe they could have been put into the core rules.
[00:59:26]
But it's still like the idea that there are no core things.
[00:59:30]
So yeah, if you can have a plug in system like that, then that would be cool.
[00:59:37]
It doesn't require more API design, obviously.
[00:59:41]
And it's going to be harder to give all the tools to your plugins that you may want to
[00:59:47]
use with them.
[00:59:48]
But if it works well, then it's great.
[00:59:51]
I could imagine code generation being really cool for something like knobs.
[00:59:55]
I mean, I don't know, maybe that's overengineering.
[00:59:58]
But you know, I imagine it's a lot of wiring to sort of serialize, deserialize all the
[01:00:04]
UI interactions to change Elm custom types and wire them through.
[01:00:09]
So you're thinking if a view function takes an integer, then you have a slider, then you
[01:00:16]
auto generate a slider.
[01:00:17]
I guess those ones would be the easy ones that it's like, well, I know how to handle
[01:00:23]
input for strings and integers.
[01:00:25]
But then for a custom type to automagically have a dropdown that just auto generate.
[01:00:31]
So you could have an API to manually give me how to turn a custom type into a string,
[01:00:39]
how to turn a string into the custom type.
[01:00:42]
And I'll present a dropdown and choose the option based on that.
[01:00:47]
But could use some nice code generation to avoid having to write those two string from
[01:00:52]
string functions.
[01:00:53]
Yeah, definitely.
[01:00:54]
This is actually what I'm doing in Elm admin.
[01:00:57]
So for the forms, you can just place custom types.
[01:01:01]
And I don't need the from string to custom type back.
[01:01:06]
Because if you provide I can just like create the pairs, right?
[01:01:10]
And I can use the pairs to get back the custom type you provided.
[01:01:14]
But yeah, this is definitely possible.
[01:01:16]
One thing that I noticed is that the whole Elm architecture is a really awesome plugin
[01:01:20]
system for if you are building this application as libraries thing, like the whole idea of
[01:01:28]
like having a message that it would change your piece of the model and you get like an
[01:01:33]
update of that piece of the model.
[01:01:34]
And you can just like you can even trigger like HTTP requests or anything.
[01:01:39]
Everything is pretty well scoped.
[01:01:40]
And you can just like map those things so that they can like stick to their small like
[01:01:46]
loop of interaction, right?
[01:01:48]
There are some ways for you to kind of like watch everything that is going on and plug
[01:01:53]
into like the right pieces of interactions, you know?
[01:01:59]
I don't know.
[01:02:00]
I feel like for libraries as a whole, it can be tricky to create like an API for plugins.
[01:02:06]
But for applications that are kind of like wrapping everything up inside of them, it's
[01:02:11]
a bit easier, I believe.
[01:02:12]
It's cool to hear you talking about Elm as a good tool for building sort of pluggable
[01:02:18]
systems and frameworks because I don't know, I would imagine that people tend to think
[01:02:23]
of it actually the opposite, that everything has to be so explicit and you can't just have
[01:02:30]
implicit state, you can't just pass anything anywhere or grab global variables as needed
[01:02:37]
or do global side effects.
[01:02:39]
If the plugin uses a message or a model and you need to define it, then you can't make
[01:02:45]
a list of those because they have different types.
[01:02:48]
Right, exactly.
[01:02:49]
So I would imagine people tend to think of it the opposite, that Elm is not a good fit
[01:02:54]
for that type of thing.
[01:02:55]
But on the other hand, it's like a very well defined thing that you say where this box
[01:03:02]
fits in and you give it the pieces.
[01:03:06]
So it's very neat and isolated and clear what the contract is on the other hand.
[01:03:10]
Yeah, I feel like this is not something that I've been working on, but something that I've
[01:03:14]
really hoped to have the time to work on.
[01:03:17]
But I feel like having an Elm, not macro system, but an Elm template layer that will always
[01:03:25]
output the source of truth, but you can work in the template layer a lot, but just have
[01:03:30]
like this small Elm generation tags that will output something else in the other file and
[01:03:36]
you can have both all the time.
[01:03:38]
Maybe something like that could help a lot with just the amount of glue code that sadly
[01:03:44]
it's kind of like it comes with all of the good things that we have with Elm, right?
[01:03:49]
But there is no denying it.
[01:03:52]
There's a lot of boilerplate that comes with having something that is really explicit,
[01:03:56]
especially when you want to do impossible states and you want to just like define everything,
[01:04:00]
you want to be really defensive in your application.
[01:04:05]
Like people in my company, I always say like, don't fear like long pieces of code.
[01:04:11]
Just do that.
[01:04:12]
It will be easier to maintain.
[01:04:13]
It's Elm, it's safe, but it's a lot of code.
[01:04:16]
So if we could like remove all of the things that are always the same and just like have
[01:04:21]
a template that we could also create in Elm perhaps, I don't know, it would be pretty
[01:04:25]
awesome, right?
[01:04:26]
Kind of like an Elm review more focused on generating code.
[01:04:31]
With building Elm pages, it's been really interesting because I think that people also
[01:04:36]
underestimate what you can do with these building blocks.
[01:04:40]
And I mean, code generation is a big part of it, but like sometimes people ask questions
[01:04:45]
like how do I get an environment variable, which Elm pages has ways to reach in and get
[01:04:50]
an environment variable.
[01:04:51]
But people ask this with other tools and I say, well, I mean, if you really need to,
[01:04:56]
you could write like a node JS script that generates an Elm file and says process.env
[01:05:03]
and gets some value and generates a top level value and exposes it.
[01:05:08]
And it's actually like five lines of code.
[01:05:11]
It's pretty easy to think about.
[01:05:13]
You have to make sure you run it at the right time on your build and on your dev servers.
[01:05:17]
And that's a little bit annoying.
[01:05:19]
Maybe there could be some like tooling to help make those sorts of things more manageable,
[01:05:23]
but actually like doing a little bit of code generation is extremely powerful and pretty
[01:05:30]
manageable.
[01:05:31]
Config, it's super useful, right?
[01:05:34]
Because since you are compiling the application, there is like you are checking that everything
[01:05:40]
is actually there.
[01:05:42]
You can't achieve something that is missing information, right?
[01:05:47]
So if Elmbook, you've talked about and I've seen in some of your notes, like some future
[01:05:54]
ideas for this CLI for Elmbook.
[01:05:57]
What might that look like if there, let's say, you were talking about sort of always
[01:06:01]
exposing docs from your sort of view modules.
[01:06:05]
What would it look like if you pointed a CLI at one of those modules?
[01:06:09]
What would it do?
[01:06:10]
Yeah, to be honest, like I would still want for people to use Elmbook like in Elm itself
[01:06:17]
so that they can actually have like all of the type safety and not like automatically
[01:06:22]
create examples for view components.
[01:06:25]
It could be possible.
[01:06:26]
But I was more leaning towards if you could output a complete Elmbook from your package
[01:06:33]
docs, for instance, and mix that up with extra stuff that you're defining as Elmbook, that
[01:06:39]
would be like for me even like more interesting.
[01:06:44]
If I accomplish that, it would be possible for me to actually like generate an Elmbook
[01:06:49]
for every package that is published.
[01:06:51]
And I could have like a second repository, like registry, and that would kind of act
[01:06:56]
as a duplicate of the packages.
[01:06:58]
We already have one like that, right?
[01:07:00]
Like a separate...
[01:07:01]
Yes.
[01:07:02]
Yeah.
[01:07:03]
Remi.
[01:07:04]
DMI.
[01:07:05]
Yeah.
[01:07:06]
Yes.
[01:07:07]
But one that we could maybe have like two tabs or something like that.
[01:07:12]
One would be like the hex docs.
[01:07:14]
One would be the actual docs and the other one would be the guides, right?
[01:07:20]
The guides, the design system and everything else.
[01:07:26]
This could be interesting.
[01:07:27]
Yeah, it would be very interesting.
[01:07:28]
I have not gotten around to it.
[01:07:31]
And I have mixed feelings about creating something that it's even more clashing with the package
[01:07:37]
docs, you know?
[01:07:38]
Right.
[01:07:39]
Right.
[01:07:40]
And then I would imagine, I mean, if there were some sort of package host for this, like
[01:07:45]
would there then be a place where you could have pure README files or Markdown files that
[01:07:54]
would be detached from a package?
[01:07:57]
Because that's what hex has, right?
[01:07:59]
You can have folders with Markdown that are independent of an actual API module.
[01:08:05]
Yeah.
[01:08:06]
Well, you could mix everything up, right?
[01:08:08]
Like you could have the guides as Markdown.
[01:08:10]
You could have like the more, I don't know, the more interactive stuff built with Elm.
[01:08:17]
Maybe register something with Elm and then use it from the Markdown file.
[01:08:21]
Because like, let's be honest, writing Markdown in an Elm file is not that great.
[01:08:27]
So like we can mix everything up.
[01:08:29]
But then again, I would not do that without first having the Elm book as a fully functioning
[01:08:35]
Elm package, right?
[01:08:36]
That would be definitely like only a layer built on top without changing any of the core.
[01:08:41]
Yeah.
[01:08:42]
I think it would be interesting what would happen with the ecosystem with that, you know,
[01:08:45]
because like right now, I know Evan has talked about writing package documentation by going
[01:08:51]
through an API and reading top to bottom, like a book, like a page in a book, you read
[01:08:58]
the package documentation and you try to present the docs in coherent sections and in a flow
[01:09:04]
that kind of makes sense and gradually introduces you to the more complex ideas, which is really
[01:09:11]
powerful.
[01:09:12]
And I definitely have tried to do that, like with Elm GraphQL, if you look at the selection
[01:09:18]
set module documentation, like I'm, you know, I put a lot of thought into making that essentially
[01:09:23]
a tutorial where it's kind of presents you with like, what is the selection set?
[01:09:27]
And it walks you through, well, here's selection set dot empty.
[01:09:30]
Here's how you can create a selection set without any fancy ideas, without any understanding
[01:09:35]
of the generated code or anything.
[01:09:37]
Here's a selection set you can create and here's how you work with that.
[01:09:40]
But if we had a separate concept of guides, then, okay, well maybe that belongs in one
[01:09:46]
place, but I don't know, maybe there's a guide for the CLI.
[01:09:49]
This is how you use Elm GraphQL CLI and here's what the code gen means.
[01:09:54]
And maybe the read me gets like a little more concise and points you to the relevant sections
[01:10:01]
of the guide to get started, for example.
[01:10:02]
It could be interesting for the community to have something like that.
[01:10:05]
I think there might be a little bit less love for the API documentation if you have guides,
[01:10:12]
like how do you integrate them into the REST, which I think works really well at the moment,
[01:10:19]
but for sure there are definitely cases where it would be super valuable to have additional
[01:10:25]
documents like even just for Elm review, I need a read me for the CLI, which is on the
[01:10:32]
NPM.
[01:10:33]
It would be super to have it inside the package registry as well.
[01:10:37]
And so I feel like I also do the story with the Elm review documentation, but if I had
[01:10:44]
a guide format, then I would probably do the same thing, but it would be better cut, better
[01:10:51]
separate into sub chapters because for instance, the review.rule module is huge because there
[01:10:59]
are so many examples in there.
[01:11:01]
And you've got extra stuff, right?
[01:11:03]
Like two things.
[01:11:05]
First, this is not really well done as I discussed with you before this chat, like the search
[01:11:12]
feature in Elmbook right now, it's really basic, but nothing for visits from being kind
[01:11:17]
of like a full search for the whole Elmbook and actually presenting some nice results
[01:11:23]
in a separate page, et cetera.
[01:11:25]
So this could be quite good for something like Elm review, right?
[01:11:30]
Like people would not have to search for functions, but something else.
[01:11:34]
And yeah, and the other thing is that like the interactive part of Elmbook, once you
[01:11:40]
have that ability, maybe you think of extra stuff that you wouldn't otherwise, right?
[01:11:45]
Like maybe you would create a code generation tool inside your own small thing.
[01:11:51]
Think of your HTML2 Elm site, Dillon, but maybe something like that could be part of another
[01:11:57]
package, but you can just generate code for the package that really fast.
[01:12:03]
This would be useful as well.
[01:12:05]
It opens up possibilities and that's mainly what is the main goal.
[01:12:09]
Well, now the question is what possibilities are those because you need to make an API
[01:12:15]
for that.
[01:12:17]
And that's the tricky parts.
[01:12:18]
If it's just having a nice way to present some sort of markdown pages and then embed
[01:12:25]
some widgets within those, then it sort of does that.
[01:12:30]
And then it's a question of how would you translate existing packages into something
[01:12:36]
that would turn into that and that gets interesting.
[01:12:39]
Yeah, because like the interactive part, you've got a kind of full Elm architecture.
[01:12:45]
You can send commands, you can get to the response and you can update your state, you
[01:12:49]
can do whatever.
[01:12:50]
So yeah, you could use an external API to do anything and just present it on your guides
[01:12:56]
or your docs or whatever.
[01:12:57]
Right.
[01:12:58]
Yeah, I like the simplicity of it.
[01:13:01]
I mean, like in a sense, it's like you said, you don't need that many features and you
[01:13:05]
don't really need to think about sort of navigating between chapters and pulling down the menu
[01:13:14]
of chapters to select from and grouping them.
[01:13:16]
Those sort of primitives are there.
[01:13:19]
You don't have to think about markdown rendering.
[01:13:21]
Some of those things are kind of annoying to set up and to think about and then kind
[01:13:26]
of presenting those things in a nice sort of overall layout.
[01:13:31]
So it's nice.
[01:13:32]
You can sort of get a jumpstart so you don't have to think about those basic details.
[01:13:36]
You can just think about your content and your widgets and that's all you have to think
[01:13:41]
about.
[01:13:42]
Well, thanks again, George.
[01:13:43]
It's been a pleasure having you on.
[01:13:45]
If people want to find out more about you, where should they look?
[01:13:49]
Where can they follow you?
[01:13:50]
Where can they keep up with what you're working on?
[01:13:52]
Yeah, they can find me on Twitter.
[01:13:56]
My handle is the same everywhere.
[01:13:57]
So GeorgeBorys and I'm always on the Elmslack and the few Discord servers as well.
[01:14:05]
I'm everywhere.
[01:14:06]
So just ping me and I'll get back to you.
[01:14:09]
One thing that I'm kind of sometimes bad at is I don't know why, but I don't get any notifications
[01:14:14]
from GitHub.
[01:14:15]
So if you open an issue and I'm not responsive, please just like ping me.
[01:14:19]
I'm not like ignoring you.
[01:14:21]
I'm just like bad at it.
[01:14:22]
Sounds good.
[01:14:23]
And are there any other resources we should point people to?
[01:14:27]
Like if somebody wants to learn more about Elmbook, what resources should they be looking
[01:14:32]
at?
[01:14:33]
Yeah, we should definitely link the Elmbook in Elmbook website.
[01:14:38]
But it's pretty easy to find in the package website as well.
[01:14:42]
If you write Elmbook, it will be the first match.
[01:14:44]
Are there multiple Elmbooks?
[01:14:46]
I feel like even book, there is like two.
[01:14:49]
There is the one that I made previously to Elmbook, which is called Elm UI book.
[01:14:53]
I didn't want people to get confused and I didn't want to be only about UI.
[01:14:57]
So I changed the name.
[01:14:58]
Yeah.
[01:14:59]
But Elmbook is the right one.
[01:15:01]
Yeah.
[01:15:02]
I know that Elm UI Explorer has the same issue.
[01:15:05]
Like it's not about Elm UI.
[01:15:06]
Exactly.
[01:15:07]
Yeah.
[01:15:08]
Just what is the author name?
[01:15:10]
DTWRKS.
[01:15:11]
What does it stand for?
[01:15:15]
This is my personal company.
[01:15:19]
It's kind of like DataWorks.
[01:15:20]
Something like that.
[01:15:21]
DataWorks.
[01:15:22]
Yeah.
[01:15:23]
Yeah.
[01:15:24]
Yeah.
[01:15:25]
But my new work is coming under a new handle called uncover.co.
[01:15:30]
So if you want to follow the other stuff that I mentioned, please take a look at the uncover.co
[01:15:36]
packages.
[01:15:37]
All right.
[01:15:38]
Perfect.
[01:15:39]
Thank you again, George and Jeroen.
[01:15:41]
Until next time.
[01:15:43]
Until next time.