Seven More Languages in Seven Weeks: Elm

Between the move and the election and the holidays, took me a long time to finish this chapter.

But I’m glad I did, because Elm is — dare I say — fun?

The error messages are fantastic. The syntax feels like Haskell without being as obtuse.  Even the package management system just feels nice.

A sign of how much I liked working in Elm: the examples for Day Two and Three of the book were written for Elm 0.14, using a concept called signals. Unfortunately, signals were completely removed in Elm 0.17 (!). So to get the book examples working in Elm 0.18, I had to basically rebuild them. Which meant spending a lot of time with the (admittedly great) Elm tutorial and trial-and-erroring things until they worked again.

None of which I minded because, well, Elm is a great language to work in.

Here’s the results of my efforts:

And here’s what I learned:

Day One

  • haskell-inspired
  • elm-installer: damn, that was easy
  • it’s got a repl!
  • emacs mode also
  • types come back with all the values (expression results)
  • holy sh*t: “Maybe you forgot some parentheses? Or a comma?”
  • omg: “Hint: All elements should be the same type of value so that we can iterate through the list without running into unexpected values.”
  • type inferred: don’t have to explicitly declare the type of every variable
  • polymorphism via type classes
  • single-assignment, but the repl is a little looser
  • pipe syntax for if statement in book is gone in elm 0.17
  • case statement allows pattern matching
  • case statement needs the newlines, even in the repl (use `\`)
  • can build own complex data types (but not type classes)
  • case also needs indentation to work (especially if using result for assignment in the repl)
  • records: abstract types for people without beards
  • changing records: use `=` instead of `<-`: { blackQueen | color = White }
  • records look like they’re immutable now, when they weren’t before? code altering them in day one doesn’t work
  • parens around function calls are optional
  • infers types of function parameters
  • both left and right (!) function composition <| and |>
  • got map and filter based off the List type (?)
  • no special syntax for defining a function versus a regular variable, just set a name equal to the function body (with the function args before the equal sign)
  • head::tail pattern matching in function definition no longer works; elm is now stricter about requiring you to define all the possible inputs, including the empty list
  • elm is a curried language (!)
  • no reduce: foldr or foldl
  • have to paren the infix functions to use in foldr: List.foldr (*) 1 list
  • hard exercise seems to depend on elm being looser than it is; afaict, it won’t let you pass in a list of records with differing fields (type volation), nor will it let you try to access a field that isn’t there (another type violation)

Day Two

  • section is built around signals, which were removed in Elm 0.17 (!)
  • elm has actually deliberately moved away from FRP as a paradigm
  • looks like will need to completely rewrite the sample code for each one as we go…thankfully, there’s good examples in the elm docs (whew!)
  • [check gists for rewritten code]
  • module elm-lang/keyboard isn’t imported in the elm online editor by default anymore

Day Three

  • can fix the errors from loading Collage and Element into main by using toHtml method of the Collage object
  • elm-reactor will give you a hot-updated project listening on port 8000 (so, refresh web page of localhost:8000 and get updated view of what your project looks like)
  • error messages are very descriptive, can work through upgrading a project just by following along (and refreshing alot)
  • critical to getting game working: https://ohanhi.github.io/base-for-game-elm-017.html (multiple subscriptions)

The Just City by Jo Walton

Inspiring. I could not imagine daring to try to write dialog for Greek gods and long-dead philosophers, but she did, and does it brilliantly.

Made me miss my days as a philosophy major, and that’s a good thing.

Three things I learned about writing:

  • Long explanations of things are ok, but only after the reader has come to know the characters, and care about them.
  • Switching first-person narrators is fine, so long as you keep the number of them down and clearly label each chapter so we know which character is speaking.
  • Sense of place can come through not just by food and clothing, but architecture and leisure activities as well.

Average

There’s a video making the rounds on Facebook that claims to show how the “average American” views the Trump inauguration.

It’s shows a lone white male, surrounded by flag art, talking about how we liberals should suck it up, and that real Americans, like him, are happy Trump won.

This video pisses me off for several reasons.

First, the guy being interviewed isn’t one of the “real Americans” he claims to represent. He’s an artist, not a coal miner. He profits off of the people he wants to speak for, but he’s not one of them.

Second, the whole idea that “average Americans” are just like this guy, and all happy about Trump, is a lie. It’s code, code that only white, uneducated males are real Americans, and everyone else should sit down and shut up.

What would a video wanting to accurately show an average American be like?

Most Americans are female. So we have to swap the dude for a woman.

Most Americans live in liberal, coastal areas. So now we have to move the woman speaking out of the implied RustBelt setting and to one of the coasts. Maybe New York, maybe California.

Most Americans do think of themselves as white, so she can be white and still be “average.”

But uneducated? Not this woman. She’s got her high school diploma, and taken some college classes. She probably has an associate’s degree, which she’s used to get a better job.

So we have a white, working-class but educated, woman living on the coasts.

She’s probably Democratic. She probably voted for Hilary. She’s likely in favor of the ACA, and the protections it provides for her access to women’s health care.

It’s the exact opposite of what the video portrays, which is why it ticks me off so much.

But more than that, I hate the implication that other people, who aren’t white, or male, or uneducated, are somehow lesser citizens.

I hate the smug superiority the video reinforces. It’s the refuge of bullies and cowards, of people looking to blame someone else for their situation.

I understand that it’s hard to make a living without a college degree. I understand it’s difficult to change careers when the factory you depended on shuts down. I understand you don’t want to move to a strange town to chase a new job.

But if I could offer some advice to them: suck it up.

Because you had their chance. You made fun of guys like me all through school. You ditched classes and slacked off on your studies. You didn’t go to college, didn’t think it was something “real men” did.

You rule out taking on all kinds of jobs, from nursing to teaching to customer service, as “women’s work”. So your wife or your girlfriend has to support you, while you wait for the Industrial Age to roll back through town.

It’s not happening. No one is coming to save you: not Trump, not Pence, not Paul Ryan. They want your votes, but they aren’t going to help you one bit.

You’re going to have to do it on your own.

And it’s your own fault. You voted to cut the ladder of economic advancement out from under yourself and everyone else.

I sympathize with you, but I don’t feel sorry for you.

You’re a crybaby, whining about the good times that have passed you by.

You’re lazy, unwilling to do the work to make something better of yourself.

And you’re a coward, afraid to join the ranks of those who have their own business, who have to justify their existence through service to others in the marketplace.

You’re an un-American burden on the country, and I can only hope the next four years open your eyes to how your pride and the Republican party have deceived you.

Editing as Worldbuilding

We’re here! Made it into San Diego last week, despite freezing rain (Flagstaff), gusty winds (most of New Mexico), and fog (Cuyamaca Mountains).

No, we’re not unpacked yet. Yes, I unpacked the books first 🙂

So, back to work. And also back to writing.

I’ve decided to do another editing pass on the first novel. I feel like I’ve learned a lot about writing in just the last few months, and I’d like to apply what I’ve learned to it, see if it makes it better.

I’d also like to go back and fill in a lot of the worldbuilding details I left vague in the first two drafts. Flesh out character backgrounds, city histories, etc. I don’t want to add a huge info-dump to the book, but I do want to make sure everything holds together better, the various pieces of book matching up to make a more powerful whole.

And after thinking through the plot more, I’m really not satisfied with the way I’ve handled the female protagonist. That’s part of why I need to flesh out the character backgrounds, specifically hers. I realized her character arc is muted, a victim of me being unsure who I wanted to be the protagonist in the first draft.

She deserves better, so I’m going to pull out her conflicts and struggles into its own storyline, an independent path to follow while she also contributes to the central plot. I think it’ll make the book stronger, and the ending more compelling.

Some of these changes will be dialog or description tweaks. Some of this will probably end up being major surgery. But I’ve got to try.

Wish me luck.

Ancillary Justice by Ann Leckie

Easily worthy of the awards it won. Fantastic ideas, presented through conflicts with interesting characters, and writing that describes just enough and no more.

And I almost stopped halfway through.

There’s a point where the protagonist does something so amazingly dumb, that I wanted to put the book down in frustration. But I kept going, and I’m glad I did. Because it only got better from there.

Three things I learned about writing:

  • Beware delaying explanations for too long. A character that says “I don’t know why I did X” too often, before their inability to explain is outlined to the reader, can lead to frustration.
  • Don’t have to wait for the character to say “and then I told them my story” to tell that story to the reader. Can layer it in, piece by piece, via flashback chapters.
  • Small touches, like bare hands being considered vulgar, when followed-through, can do a lot of work to make a culture feel real.

The Creation of Anne Boleyn by Susan Bordo

Fascinating. Examines both what we know about Anne Boleyn (very little), and the stories that have been told about her (very much).

Turns out most of what I thought was accepted history is in fact based on gossip spread by her enemies.

Three things I learned:

  • Execution of Anne was the first time a queen had been executed in English history
  • Anne spent a good deal of her childhood on the continent, under the tutelage of Marguerite de Navarre (sister of Francis I of France) who ran the most philosophically glittering salon in Europe
  • The intelligent, pro-reform Anne of the second season of The Tudors is due mainly to Natalie Dormer, who wanted to portray an Anne closer to the historical one than had been done before

Idle Hands

No writing this week. The novel’s done (for now), so I’ve been focused on the upcoming move, getting everything boxed and labeled and loaded. 

It’s like having our lives flash frozen, to be thawed on arrival in California.

Not having a writing project to work on is, as ever, weird. It’s as if school exams have been canceled, but just for me: I feel like I should be studying, but I’m not. Because I don’t have to.

Not that my brain has noticed. Woke up in the middle of the night with an idea for another story. I think it’s a flash fiction piece, but there might be more there. Have to write it and find out.

It’ll have to wait its turn, though. Behind the move, and the novel edits, and the short story edits, and querying agents, and the…ye gods, I’ve got a lot of work to do.

Excuse me, I need to go write.

There are No Sides. Just the Truth.

Dear U.S. Media: Please stop reporting both sides.

I know you want to appear impartial. I know you want to be trusted.

But here’s the thing: by reporting ‘sides’ instead of facts, you reinforce the idea that having sides is legitimate. Instead of pushing both sides to acknowledge the truth, you let their opinions stand.

The result? Neither side trusts you. Because you’re no longer digging for the truth, you’re just a parrot, repeating what you’ve been told.

This idea that you need to repeat both sides is itself a political one. It goes back to the days of President Nixon, when his staff used the threat of the loss of FCC licenses to get tv news organizations to spend more time giving the President’s “side” of things. Instead of just sticking to facts.

I know, I know. You think the “truth is in the middle.”

But that’s false.

There was no middle ground between Saddam Hussein having nukes or not.

There’s no middle ground about where President Obama was born.

And there will be no middle ground about the lies a President Trump will tell.

So please, stop pretending to be impartial.

The facts aren’t impartial. The facts always support one side over another.

It’s time you started supporting them.

Going Home

Thank the gods 2016 is over.

I think it’s been a rough year for many people. My rough 2016 actually stretches all the way back to fall 2015, when my wife and I upped stakes and moved back to the mid-south to take care of her mother.

The stress of that time — her mother’s health, the terrible condition of the house we bought, the shock of discovering that all traces of the friendly South we’d once known were gone — almost undid us. We felt abandoned, hated by our neighbors and resented by her family.

Things improved when we were able to tread water enough to reconnect with our friends, plug back into the community of accepting nerds and geeks we’d missed.

But the presidential campaign, culminating in the election of a liar, a swindler, and a bigot, convinced us that nothing could make up for the fact that we don’t belong here. And never will.

So we’re moving back to California.

Back to a state that takes life seriously, and so passed the most restrictive gun control laws in the country.

A state that takes liberty seriously enough to want to offer it to refugees from a horrible civil war.

A state that knows the pursuit of happiness means respecting the many diverse ways that its citizens go about it.

I can’t wait to be back home.