Overall, I found Reason and ReasonReact surprisingly easy to get started with. My general process was to 1) read most of the documentation for Reason and ReactReason 2) follow the Bsb installation and quick start and 3) try to modify the quick start application, one little feature at a time, until I arrived back at my random quote generator. Below, I’ve written out some of the dumber mistakes I made.
My computer science background is weak. When I saw that Reason had lists, I thought of the Ramda documentation and how it seems to refer to arrays as lists with no apparent explanation. Despite the fact that Reason’s documentation clearly spells out that lists and arrays are different, I tried to use lists and access them with
myList syntax and inspect them in the console and felt confused as to why they looked so weird and wondered how I had instantiated them in such a weird way.
I generally abandoned lists in my project in favor of arrays. It wasn’t until I was done that the term “doubly linked list” popped in my head and I had a vague flashback to writing in C++ for a community college class on data structures.
I assumed that using ReasonML would complicate my webpack configuration. I deleted my config file in favor of what was shipped with the quick start project. This was fine until I wanted to add back styling. After a bit of research, I realized that I could just copy and paste anything involving styling from my original webpack config to my new one and use some weird syntax to import my CSS files like before.
I kind of tried to force pattern matching and switch statements into my random quote generator. I wanted to use a switch statement to create potential bounds of a generated random number, between 0 and the length of an array of quotes. I saw the note below in Reason’s documentation, but didn’t really understand what I was supposed to do about it:
Note: you can only pass literals (i.e. concrete values) as a pattern, not let-binding names or other things.
I had trouble trying to add the length of the quote array as a potential
case. I ended up switching to
if statements and kept moving forward. Pattern matching is a subject I need to revisit.