Why Did You Code Your Personal Website in Haskell?
How it started
One day I was in the basement of Hayden Hall on campus and I was approached by a suspicious hooded figure who smelled like matcha powder. He came up to me ominously offering me a book of divine power: "Learn Haskell by building a blog generator." It was intriguing to say the least but I took it in stride and challenged myself to learn Haskell over winter break.
The Process
At first the extremely functional nature of Haskell took me aback. As somebody entrenched in low-level and often very verbose programming languages like C++, it changed my perception of programming languages entirely.
A massive difference I found right away was how types worked in Haskell and how useful Type Classes are, specifically with multiple input polymorphism. Another notable difference was the explicit nature of said inputs compared to a language like C++ where type conversions are largely implicit. I'm currently still getting used to implementing more Functors into my code and utilizing abstractions rather than mutation, not just in Haskell but across all languages I write.
What I Learned
Through this project, I gained hands-on experience with:
- Building embedded DSLs in Haskell
- Functional programming patterns and type-driven design
- Static site generation from pure data types
- CSS generation using the Clay EDSL
- Lucid for type-safe HTML generation
-- The core of my Blog DSL
data BlogElement
= TextContent Text
| HeaderContent Text
| Image Text Text (Maybe Text)
| CodeBlock Text Text
| BulletList [Text]What's next + The Mysterious Figure
My next steps are adding a Markdown parser for better formatting, expanding the CSS EDSL, and building out the Projects page. Also, the mysterious figure was my good friend Lucas. Please make sure to endorse him in "Rizz" when you have the opportunity.