littlelogs

Keep a social journal of your work progress as you make and learn things.

#PureScript

May 2017

rhitakorrr
rhitakorrr

Got the #MidnightMurderParty editor back in working condition! As I thought, tonight was dedicated to entirely rewriting the #JSON encoding/decoding using #PureScript Argonaut. Mostly, it was pretty simple—just a lot of rewriting—but I did run into one super sneaky “gotcha!” right at the end. For some reason, my encoding was leaving out a field, no matter what I was encoding.

"secretKey" := secretKey
~> "data" := postData 

This was leaving out the "data" field, for example. I only figured out what was wrong because, after the server got mad at me for sending bad data (or no "data", rather), I dumped my other JSON to the console and dug through the keys until I spotted the correlation. Whichever field was encoded last just didn’t get encoded at all.

Turns out the fix was simple:

"secretKey" := secretKey
~> "data" := postData
~> jsonEmptyObject

Yup, just slap an empty JSON object onto the end of the extend (~>) chain, and it works.

rhitakorrr
rhitakorrr

Upgraded the #PureScript version for the #MidnightMurderParty editor tonight. I tried the upgrade on Sunday on my Ubuntu laptop, but nothing was working out. The upgrade went much more smoothly tonight on my Windows desktop. Go figure. In any case, PureScript is now an #npm dependency instead of a global install, and I’ve added a build task in #gulp. Still working on adapting the code since all the #JSON encoding/decoding stuff has been changed around in this version of PS and VS Code is being finicky after the upgrade.

April 2017

rhitakorrr
rhitakorrr

Worked on the #MidnightMurderParty editor some more. I rigged up the front-end with the back-end finally. I’d started that last night but got stuck on mismatched types, cursed at the language for a little, and gave up. Today, I looked at it again, saw the issue immediately, and fixed it. Sometimes it helps to take a break… and sleep.

Wiring up the #AJAX requests revealed a lot of bugs in my #JSON encoding/decoding—the code I wrote at the beginning of the month when I was just starting with #PureScript. Here’s a photo of me from way back then:

After much head-scratching and cryptic errors, I got it all working and now have an ugly/barebones CMS. I can add (from Docs), delete, reorder, and edit chapters. Next is finishing the module that will let me sync an existing chapter with Docs, then mostly cleanup and UI.

Finished Camp #NaNoWriMo at ~14,000 words.

rhitakorrr
rhitakorrr

Time for a mega, 3 weeks #laterlog. [1/2]

I just finished a dev session on the #MidnightMurderParty editor, so I’ll start there. When I started learning #PureScript earlier this month, it was all confusion, overwhelming UI library choices, and packages that were lacking. Simultaneously learning this language and developing an application in it has been quite the ride.

But it’s been fun. The learning curve was (and still is) much steeper than #Elm’s, but as I learn this language, I’m coming to appreciate how much freedom its complexity gives me. The massive boilerplate which is rampant in Elm code hardly exists here, from what I’ve seen, because most of it gets abstracted away.

I’ve now gotten most of the old editor screens coded (though not fully #functional, ha-ha) and have added some new features, namely Google login and Drive Filepicker, so I no longer have to download a Docs file, open it in a text editor, copy the HTML, and paste it into the editor. I just pick a file in the editor and go.

rhitakorrr
rhitakorrr

Finally got the #JSON encoding and decoding working for the #MidnightMurderParty editor. I’m finding that, while I really enjoy #PureScript as a language, the packages are lacking. I think #Elm has it beat so far in the useful docs and full-featured packages department, even if Elm is a much weaker language.

Tonight I finished adding audio to the MMP promo animation—at least as much as I’m going to be able to do before I have music to work with. Simulating movement through a room by automating the volume and panning of two clock-ticking clips with different amounts of reverb/EQ was fun. One for close to the clock, one for in another room, and a lot of tweaking.

I’m also a little ahead of my Camp #NaNoWriMo goal, which isn’t too impressive since I only committed to 10,000 words this month, but I have been writing nightly. My next goal is to shift my writing to the mornings again. I really like writing in the morning, but I don’t like waking up very much at all.

rhitakorrr
rhitakorrr

I’ve been primarily working on 3 things this week:

  • PureScript Editor. The old #MidnightMurderParty editor (my custom CMS) was written in #Elm 0.16 and is basically unmaintainable since 0.16 is so different from the newer versions. I’ve been looking for an excuse to learn #PureScript for a while, so I’ve been rewriting the entire editor in that. I’m still just trying to get JSON decoding working, though.
  • MMP Promo Animation. The promo animation for MMP is done, and now I need to soundscape this whole thing. I started editing with OpenShot, but that can be summed up in one word: Crash. I’m now using Blender as my video editor. So far, I really like it. While I pair up SFX with the video, @larouxn is working on the music. It’s coming along pretty nicely.
  • Camp NaNo. I set my Camp #NaNoWriMo goal for the month to 10k words. I’m trying to finish one #shortstory, write another, and maybe get some MMP writing in there as well!