Episode: 2618
Title: HPR2618: Yesod - First Impressions
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr2618/hpr2618.mp3
Transcribed: 2025-10-19 06:38:19

---

This is HPR Episode 2618 entitled, Yes on First Impression.
It is hosted by Tuku Toroto and is about 23 minutes long and Karima Clean Flag.
The summary is Tuku Toroto talking about their first impressions on Yes on Web Framework.
This episode of HPR is brought to you by AnanasThost.com.
Get 15% discount on all shared hosting with the offer code HPR15.
That's HPR15.
Better web hosting that's honest and fair at AnanasThost.com.
Hello HackerPafiCradio, this is Tuku Toroto and today I'm talking about my first impressions
on the Yes on Web Framework.
Yes on this written in Haskell.
The website that you are building, you build with it is also an AnanasThost.
It's, I haven't been using it a lot yet.
I have been just building a simple toy simulation about space with it.
So basically a plenty of little bit of database work, little bit of showing stuff on the screen,
little bit of user input, all the basics of a website.
I haven't been doing any JavaScript yet with this or any other lines like scripting.
But so far I quite like the Yes on it's based on a, it works, it's based on a controller
approach, like there's a similar point of entry for all the requests that come into the system
and then they are from, they are, they are rooted to the respective handlers and
configuration of that is done with a simple text file.
It can't run every once in a while of how Internet Go for example works in this respect.
What I really like about the handlers is that I guess it's on the landscape scenes,
take care of that if you're passing in parameters, those parameters are automatically validated,
you cannot stuff for example text into a, I'm going accidentally and from that point on when
the data has ended to the system from the request, they are strongly typed because they're
working with the Haskell and they're actually strongly, strongly typed data is another thing
that I really, really like about Yes or everything. For example, when you're loading things from
the data, it's, but therefore the fault Yes or T uses persistent as a backend, but it's,
if I can correctly, it's possible to use something, some other systems too, but with, at least with
the persistent, the system gives track of, for example, if you are loading or, for example, in my case,
star with the ID, that ID is on the database, it's just a number,
in the data basically, and in my case, on the database, spars and planets have IDs,
the data is level data, the data data is same, it's in the data, but on the Yes or T side,
they are key planet and key star, so it's not possible to accidentally load a star
with a planet ID or vice versa, same, same thing when you're updating the data, on the, on the
database level, the Yes or A persistent keeps, ensures that you are not accidentally mixing data
apps, sometimes this might feel a little bit awkward, if it took me a bit to find out
how to load data, if you, for some reason, if you want to load with a hard-coded ID,
that's just a number, for example, if you want to get a certain record with that,
but I found out there's a function called SQL, two SQL keys, that can be used to create any
turn in that into a key, and then just use the Periscence load method with the ID,
and for the Haskell to be able to infer what type you are loading from the database, you might
have to provide a typing at that point, models, the rendering side, turning the data that you
loaded from the, from the database into a web page that is so about the uses, Yes or T uses
a template system, they actually have a several template are, several kinds of templates,
take all the, take all the six-perent family of template languages, and I don't know where
that comes from, but for example HTML templates are written online, in language called Hamlet,
JavaScript templates are in Julius, and CSS is with the Cassius or Lucius.
I have, as I said, I haven't done any JavaScript, and I have done quite a little bit of CSS,
mainly I've been doing HTML, so Hamlet template system, it pretty straight forward,
like you have tags, instead of tags, you have your data, just like in the HTML page, and then you can
evaluate Haskell code inside of a template, and if you have a value of something, some variable,
you can place content of that variable inside of a template, and that gets rendered on the,
on the HTML, for that then of course, of course needs to be, because the HTML and the
for example, numbers are not the same thing, from the point of view of the Hamlet, so they
need to be a function that does the conversion to the HTML, and the data provides, provides
most common ones, but if you are, for example, if you are, in my case, wanting to render a
spectral class, or luminous to class, or else, you, I, I, I, I, I made those a custom data
title, that's on the, on the code, so I had to make a, to HTML function for them, so that the
result would know that, okay, this one, when given this type of data, this is how I turn it
into a markup, okay, I, it was to markup, not to wait, to markup, and you can implement a,
you can put a logic inside of the Hamlet template, like if loops, things like that, if you're
giving a list of things, you can easily loop, put a list and repeat some action for each of them,
for example, for rendering a double art data, neat thing is that the, on this, on, on the Hamlet
side, the data types are enforced too, so if you're passing a, for example, in my case, a star
object here, and you want to display the luminous to class of that one, I have a functional luminous,
star luminous to class, that takes a star, and gives you a luminous to class, and I can call it,
I can call that function on the Hamlet side, and yes, I would make sure that the data that I
passed is actually a star and not a planet, it is really, really neat, the, while the compile times
can be a bit annoying sometimes, it's really nice that the system makes sure that you don't
accidentally mix, mix these, on the template side, whereas in the Hamlet call that I've been using
to, there, it's really quick to change the template that I used to, used for rendering the data,
because that doesn't create a compilation, but of course, there, you don't have a pipe
in the same way as you have in the Hamlet. One thing that took me a quite a bit off, well next
note that, that much one thing that took me a little bit off, getting used to this, that Hamlet
valid has a tax, like HTML head, body, h1p, such, for creating HTML, it only uses the
beginning, that it doesn't have a closing tag, instead it marks the structure in an indentation,
so it's a, for example, it does, it in the same way as a pipe on the code, so the Hamlet templates
only have the open in tags, and everything that is inside of that tag, or support the
stack are intended from the original level. In the beginning, it might look a little bit funny,
but on the other hand, it also enforces you to write a nicely intended HTML, which in my opinion
is good thing. You can, you can break your, your, your, your rendering side into components
and easily, code widget, and those can be preused in multiple places, and widget can contain
HTML, CSS, and JavaScript. And, yes or no, will take care of when you include a widget on a page
that has a respective HTML catch interest in the correct point on a page, and the script,
if you are referring to a script, it gets included in the header, and they see it as included.
There's a, forms, of course, that you can do, I haven't done much of those, just a,
one little form that you can use to, when a new player looks into the system, they can select
what a fraction they want to play as. And, I found, forms are a little strange,
that probably, probably, probably would understand them better if I would use them a bit more,
but, on a, on a form level, they are going to have safety, and you can have a validation, and,
well, that, well, they are, like, forms.
What else? This, of course, are authentication, authorization, out of the box, there's a
several different ways of doing that, like, usual, username, or email, and password, or open
an ID, or what have you. And, rolling out your own, doesn't look too tricky, for, for so long,
for so far, I have been using a system that, that just lets you do time, that I want to be at this
site. Well, you basically just type your use ID, and it looks you in, I think, as with that one,
I'm planning to replace that, it's something else, I don't play that, but it's just happening
so many things to, things to learn, so I haven't, haven't had time to, haven't had that time to
do that. And, what I have been struggling quite a bit is that, I don't know, Haskell that,
well, I have written a little, little, little programs now and then, and, and Haskell's very
valuable, error messages are sometimes a bit hard to decipher, and, and the other thing is that
yes or yes, it uses quite a, quite a bit of extensions, like, type families, templates,
multi-parameter classes and whatnot, so, there's a quite, quite a bit of things going on, on the
yes or yes, well, there's a, the persistent is used for the database, and the database is,
at least in the example that I started, took, took a space and started modifying,
the database is done, you know, sort of like a model first, like you, you have a
one file where you describe your data, what, what entities you have, what, what members they have,
and from that, yet, and also what relations do they have with each other, and from that, yes or
yes or it generates you a database and object, so on the, as long as you keep using that, your
database and your objects on the code, code, or data on the code, on the code side, I'll get
into it, there's also a rudimentary migration script that you can automatically run, but the,
yes or no, once you're not to use that in the, in the production, usual, always, in production,
review those scripts, and test them, and not plan to trust them,
but that's, that's about what I have been doing, I think, I haven't deployed my application
anyway yet, I'm happy using the yes or no development server, which is a very nice view,
you start, start, development server if you're using a stack for stack, that build system,
I think it's a build system, or package management system, some, some has got, has got
thing that I don't really have that much experience, so you can start, start, or yes,
a development server by issuing stack, exit, dash, dash, yes or develop, and that will, a
compile your code, update your database, start the web server, so you can start using your
website, and it will also monitor your files, so if you change something, it will automatically
recompile the project, so that you don't have to manually keep recompiling it,
I haven't been doing that much of testing, the little that I have been doing has been with
a quick check, which is really cool, testing framework, framework for proper based testing,
instead of making our examples, this when this function is called this values,
you should get this value back, you write properties in a form that this function
called with this type of data will always behave in this way, the canonical example is that
for any given string reversed twice will be the original string, or any given string reversed
will be as long as the original string, so you sort of write the abstractions a little bit higher
it's really refreshing, I have been doing that a little bit earlier, and I tried that with a
snapshot as a quick check library, I think it was even called quick check, the Haskell's quick check
has inspired quite a lot of growth of the libraries, and on the Python or high, there's a hypothesis
that draws inspiration from the quick check, and I find it really neat way that I can just
write a generator that will give me for example all kinds of planets, all kinds of stars,
stars of different sizes, and spectral types and luministic classes, and the gruntos
through some function, and check that the some invariant thing of function is always observed,
it's a really slow compared to what I have gotten used to in writing unit tests, but I believe that
it's partly because it's new to me, and partly because you have to think a little bit
a lot more general way, it's not enough to come up with a single anchor sample,
so I have to actually get to the bottom of the things and find out that this is how this
function is supposed to work, which is of course, one will think that that will be the basic
essence of development that you actually know when you're writing a function how it's supposed
to work, but at least for me I quite often think in a sample or some constraint data, and don't
do nothing to think in general sense, so when you're running those tests quick check will
run those, your generators can generate a bunch of test cases in my case, there's a hundred
test cases per property, and then check that all of those are all of those test cases hold through,
and if you find something that does not hold through, it even tries to come up with a simple
example where it fails, and then it reports that this property does not hold with this value.
There's a way of testing the HTML side on a code level, but I only had a cursor look on that,
probably going back to that at a later point, probably if I were doing this for real,
professionally I would maybe use some tool that is meant for that, specifically that can run
JavaScript, and that can actually render things on screen, and take screenshots and such,
like a robot framework, for example, that's probably more of those, that's a bit unknown
side for me, too. Yeah, that's about it, I probably forgot tons of things, but I find that
yesterday was a bit intimidating to get started with, but when you got over the initial hump,
and the example side that it comes with helps you quite a bit there, it's been really pleasurable
to work, I struggled with the very basic things now and then, but I don't think that's the
method, yes it's fault, it's just a little bit different world, then what I had you couldn't use,
but I really like that it provides, it catches a lot of errors that call, I'm kidding now,
it catches a lot of errors that are used to be being unknown, this until you actually start
using the side, for example, you can have a URLs generated in your hamlet code, in a way,
that it actually checks that, I mean that yes it actually enforces the existence of that
URL, basically you are, basically you are instead of throwing in a magic string, HTTP,
colon slash slash something, you are throwing a, a, a, a, a, mark, and the name of the resource you're
referring to, and the yes I feel automatically find the correct URL, correct one into that resource,
and insert it, while it's rendering the one screen on, on, on HTML, and that is, that is really
neat, if you then later on decide to restructure your site and move things around all those
URLs are automatically serving correctly, it is really cool, I like that, automation is good,
good thing when it helps you, with things like that, the little bit of change on that I have been
doing, it's relatively easy to, to, to, to, serialize your data from and to JSON,
this, but I think that's all I can think of saying about this at this point, if you have any
questions or comments, or if you have been using yes or not, so, in fact, on how to, how to do
things, or what helps you to get started, or what, what, what, what, the, the, the, the, the false,
that you, wished, you had known before starting, do let us know and record your own, show on
H.O.P. radio. Okay, talk to you later.
You've been listening to HECKAPOBLICGradio at HECKAPOBLICGradio.org. We are a community podcast network
that release the shows every weekday, Monday through Friday. Today's show, like all our shows,
was contributed by an HPR listener like yourself. If you ever thought of recording a podcast,
then click on our contribute link to find out how easy it really is. HECKAPOBLICGradio was founded
by the Digital Dove Pound and the Infonomicon Computer Club, and it's part of the binary revolution
at binrev.com. If you have comments on today's show, please email the host directly, leave a comment
on the website or record a follow-up episode yourself. Unless otherwise stated, today's show is
released on the Creative Commons Attribution ShareLive 3.0 license.
