Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
tlaplus
TLC is a model checker for specifications written in TLA+. The TLA+Toolbox is an IDE for TLA+.
-
adventofcode
Advent of Code solutions of 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 and 2023 in Scala (by sim642)
Lesson Learned: You read this far just to see me troll Evan. In all seriousness, use the type system and functions to return meaningful types vs expecting low-level, non-meaningful primitives to pattern match. This kind of thinking leads to the Boolean Identity Crisis. Or use ReScript with React and their super-fun-to-debug useState hook. Side effects Crazy Town®? Bruh, it’s fine, you can now pattern match on negative ints.
Lesson Learned: Elm has built in recursion improvements for a variety of positive reasons, and you should think in recursion to solve looping problems. Use property/fuzz tests and bounds checking with early exit to prevent this from locking up your UI (i.e if > 9000, omg abort). If you’re algorithm is reasonable, but the data set is just gigantic, offload to a server instead for more horsepower. Or Workers if you don’t have server chops, can’t upload the large data, or don’t trust your server devs. (“But Doc, I’m the server dev!” Good joke. Ever̸y̴b̸ody laugh. Roll on s̵͓̆nâ̶̱re drum. Curtains.)
Lastly, I didn’t cover it because the code for it is too mind numbing, but basically anything to do with Browser.Navigation, Tasks, or sequencing HTTP calls opens a world of hurt for race conditions. This kind of distributed networking is extremely hard to get right, even using formal method tools like TLA+/Alloy. It’s just easier to combine with automated testing via Cypress and manual testing… and as usual, really really thinking hard about how to model things using your types, even how things change over time.
Lesson Learned: You read this far just to see me troll Evan. In all seriousness, use the type system and functions to return meaningful types vs expecting low-level, non-meaningful primitives to pattern match. This kind of thinking leads to the Boolean Identity Crisis. Or use ReScript with React and their super-fun-to-debug useState hook. Side effects Crazy Town®? Bruh, it’s fine, you can now pattern match on negative ints.
Lastly, I didn’t cover it because the code for it is too mind numbing, but basically anything to do with Browser.Navigation, Tasks, or sequencing HTTP calls opens a world of hurt for race conditions. This kind of distributed networking is extremely hard to get right, even using formal method tools like TLA+/Alloy. It’s just easier to combine with automated testing via Cypress and manual testing… and as usual, really really thinking hard about how to model things using your types, even how things change over time.
While I’ve only run into the memory problem during extreme Advent of Code which has extremely large data set sizes in later challenges, it’s clear it’s no one needs to worry about it in day to day work. Also, if you compile for production, Debug.log/Debug.todo goes away.