, 24 tweets, 3 min read Read on Twitter
Mental note: make sure any mains cables you disassemble are disconnected from said mains before you touch the energized conductors.
Guess how Haskell saved me from electrocuting myself today.
It didn't, that's how. Haskell is a programming language, not an electrical tool. It won't stop you from doing something stupid irl.
But there's something powerful to be learned here.
Here's my collection of scopes. Probably like a dozen. That's just tke tek 7k series. There's more. I'm far from a newbie to electronics.
The first time I got shocked by mains was when i was ~4.
Yet today I still managed to footgun myself. How did that happen? What can we do?
You could imagine a better extension cable that cannot be disassembled when energized. Something about mechanical design. Kinda stupid.
I mean both ends of the cable would need to be connected rigidly and it would cost a lot more, but it may save some lives. Like maybe mine
We can't prevent footguns here.
In the imaginary make believe world, this safe albeit weird design could well work. Thinking is free. Imagination is free. Logic is free.
Real life: Just make the wooden block the right shape and it'll go in the right hole. Easy
Idea world: guess what the version of this is here? Types, that's right. If you don't use types you just have dozens of the round block.
In Haskell we can express the basic idea of "round hole hates square block". In Clojure, Python etc we can't.
Things in Clojure fit into all holes, like silly putty. Try building a house out of silly putty. Let's see how that goes.
Or better yet, try holding onto one of your silly outty concepts. Just seconds ago it was a house, now some bully kid mashed it into a tree.
Seconds ago it was a number, now it's an array. Silly putty typing. Try reasoning about code like this. No, code needs to be rigid. Solid.
Guess what, there's more. Haskell can describe children's blocks. But it can also easily describe this silly no-death cable from above.
Suddenly you're preventing serious accidents with "type bs". You get saved from your own sloppiness, like I didn't today. Could've died.
Well, in Haskell you can eg make sure a value doesn't get inspected before it's done being created. The compiler will tell you if you try.
You can do a lot more other "belt and suspenders" stuff, and guess what, everybody does that.
If C is running with scissors, Haskell is the Easy Bake Oven. Clojure is running with scissors while @richhickey is watching you. He'll help
He doesn't replace being in a fully safe environment where your ideas have a rigidity to them and where you can have all sorts of safety
That's what I've learnt from nearly being electrocuted today. Thank you for listening to my rant
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to cheater of death👼
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member and get exclusive features!

Premium member ($3.00/month or $30.00/year)

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!