🍫 CocoaPatterns — iOS & Mac Development Since 2009 RSS
🍫 CocoaPatterns
Because someone has to write this stuff down
"We ship apps. Sometimes they even work."

How I Forgot Everything I Knew About Programming, Then Tried to Learn Haskell, and Rage Quit

A shorter, more honest version of the previous post.

DP
Dana Purcell
@dpurcell_dev · CocoaPatterns

Yesterday, my colleague Thaddeus published a 2,000-word reflection on his Haskell journey. It was beautiful and introspective and he clearly grew as a person. I read it and felt competitive, so here is my story.

Day one: installed GHCi. Opened REPL. Typed 1 + 1. It returned 2. I thought: okay, I understand Haskell. I was wrong.

Day two: tried to write a function that returns different values based on state. Haskell: "No." Me: "But what if—" Haskell: "No."

Day three: read the first chapter of "Learn You a Haskell." Appreciated the drawings. Understood approximately 60% of the words, in isolation. The sentences were harder.

"The IO monad is just a way of sequencing side effects in a pure language." Okay. Sure. And what's a monad? "A monad is a—" Stop. I need a minute.
⚠️ The Moment

Day four. I read the sentence: "In Haskell, a program is a value of type IO ()." I closed the laptop. I went for a walk. I downloaded Xcode when I got home and wrote a UITableView delegate in Objective-C from memory like a person who respects themselves. I felt better immediately.

Thaddeus says he "learned what a monad is." I believe him. I do not want to know what a monad is. I want to ship apps. These are different goals and both are valid.

Current status: happily writing Swift 1.0 code that crashes in new and exciting ways that at least make sense to me.

// Swift 1.0. This compiles for reasons no one fully understands.
// It crashes for reasons everyone fully understands.
let result: AnyObject? = nil
let value = result as! String  // yolo
println(value)  // EXC_BAD_ACCESS. I'm home.
3 Comments — Powered by Disqus
TW
twren_fp · 22 hours ago
I feel attacked by this post specifically.
DP
dpurcell_devAuthor · 21 hours ago
@twren_fp You were an inspiration.
BK
bradkow_ios · 20 hours ago
The Swift 1.0 as! cast at the end is a bold artistic choice.