···8899## Picking a language
10101111-Every semester my college assigns us a major project. This usually meant coming up
1212-with a startup concept or designing a website in Figma, but we never got to
1313-actually put our ideas _into practice_. This semester was different.
1111+Every semester my college assigns us a major project. This usually meant
1212+coming up with a startup concept or designing a website in Figma, but we never
1313+got to actually put our ideas _into practice_. This semester was different.
14141515-Our task was to build a project aimed at helping firefighters handle a *large volume* of incidents.
1616-Being responsible for the backend _mostly_ by myself, I was a bit insecure.
1717-I needed something reliable and built for getting things done _fast_.
1515+Our task was to build a project aimed at helping firefighters handle a
1616+*large volume* of incidents. Being responsible for the backend _mostly_ by
1717+myself, I was a bit insecure. I needed something reliable and built for getting
1818+things done _fast_.
18191920The rest of the class went with safer, popular choices like Python, TypeScript
2021and Java. They're great for building an API, but I couldn't imagine doing
···35363637### Errors as values
37383838-One of the main reasons why I went with Gleam was their approach to *error handling*.
3939-Errors in Gleam are treated as _values_ you can return from any function.
4040-And the best part, *you can see if a function can fail by looking at its return type*.
3939+One of the main reasons why I went with Gleam was their approach
4040+to *error handling*. Errors in Gleam are treated as _values_ you can return
4141+from any function. And the best part, *you can see if a function can fail
4242+by looking at its return type*.
41434244```gleam
4345fn do_work() -> Result(String, MyCustomError) {
···6163### Pattern matching
62646365Being able to build custom error types pairs really well with
6464-Gleam's *pattern matching*. You can define it at the top level scope and easily `switch`
6565-on all possible values.
6666+Gleam's *pattern matching*. You can define it at the top level scope and easily
6767+`switch` on all possible values.
66686769```gleam
6870case err {
···127129## Working with SQL
128130129131I'm really not a fan of using regular strings to store SQL queries,
130130-there's no *autocomplete*, no *syntax highlighting*, no *linting* from my editor.
131131-Luckily there's a package that takes care of all that for us!
132132+there's no *autocomplete*, no *syntax highlighting*, no *linting*
133133+from my editor. Luckily there's a package that takes care of all that for us!
132134133135[Squirrel](https://hexdocs.pm/squirrel) finds all database queries in your project
134136written in actual `.sql` files, and generates modules, decoders and
···154156```
155157156158We can then query our database simply by calling a function.
157157-There's no need to set up an ORM, build complicated decoders or do anything fancy.
158158-One thing you'll hear a lot from the Gleam community is that
159159-[all you need is data and functions.](https://mckayla.blog/posts/all-you-need-is-data-and-functions.html)
159159+There's no need to set up an ORM, build complicated decoders
160160+or do anything fancy. One thing you'll hear a lot from the Gleam community
161161+is that [all you need is data and functions.](https://mckayla.blog/posts/all-you-need-is-data-and-functions.html)
160162161163```gleam
162164// Querying a database might fail, so it returns a `Result`!
···170172171173The returned results can easily be encoded into Json and sent to the client
172174through the response body. There's even a LSP code action for it!
173173-Just mouse over the type you want to generate an encoder for, and trigger the code
174174-action selector by using your IDE.
175175+Just mouse over the type you want to generate an encoder for,
176176+and trigger the code action selector by using your IDE.
175177176178```gleam
177179import gleam/json
···193195194196## Conclusion
195197196196-This was my first time building a backend project, and if it didn't work as expected,
197197-the whole group would be affected. Thankfully we ran into zero runtime errors so far,
198198-and all endpoints behaved as intended.
198198+This was my first time building a backend project, and if it didn't work
199199+as expected, the whole group would be affected. Thankfully we ran into zero
200200+runtime errors so far, and all endpoints behaved as intended.
199201200200-Errors were explicit, data had clear shapes and most error messages felt more like guidance
201201-than of a bunch of scrambled text. If you ever need a reliable backend API, I trully
202202-recommend you [give Gleam a try](https://gleam.run/).
202202+Errors were explicit, data had clear shapes and most error messages felt more
203203+like guidance than of a bunch of scrambled text. If you ever need a reliable
204204+backend API, I trully recommend you [give Gleam a try](https://gleam.run/).
+2-1
priv/posts/uses.md
···3838### Version Control
39394040- [ ]{.nf aria-hidden=true} [Tangled][]: I recently moved away
4141- from Github, tangled feels like breath of fresh air. All data is stored in my PDS[^pds]
4141+ from Github, tangled feels like breath of fresh air. All data is stored in my
4242+ PDS[^pds]
4243- [ ]{.nf aria-hidden=true} [Jujutsu][]: Feels more flexible and intuitive
4344 than Git, also tangled has support for it!
4445