(Unofficial) PureScript Cookbook

In the recent meetups, we’ve talked about having a “cookbook” form of documentation. I’ve created a repo for that purpose. Please see and participate in the discussion here: https://github.com/JordanMartinez/purescript-cookbook/issues/1. If you have come across a problem and wanted to know how to do X (e.g. routing in Halogen, date manipulation, removing the Nothings in an Array (Maybe X), etc.), please open a recipe request for that by clicking on ‘new issue.’

The reason why this is “unofficial” is because I want a fast iteration cycle. I don’t expect all of the recipes at this point to be high-quality things. The good news is that PureScript makes it easy to refactor. So, if you have a crappy solution to some problem, please submit it. It should help new learners figure out how to do certain things.

See the Rust Cookbook for an example of what this could look like.

11 Likes

I like this idea. Especially with lots of little basic examples, here and there.

I’ve been doing web software development for about 15 years. Node.js/JavaScript since 2015. I still can’t figure out how to 1) read a csv file 2) store it in a variable 3) print that variable to console. It’s like I’m starting all over. I feel embarrassed just typing this.

6 Likes

this my friends is awesome. I really appreciate that!!!

1 Like

I still can’t figure out how to 1) read a csv file 2) store it in a variable 3) print that variable to console.

Open up a recipe request in the repo!

There’s a few recipes that come to mind:

  • how to parse a CSV file (maybe this could become its own library?)
  • how to read a file and output its contents into the console
  • a recipe showing the combination of both
2 Likes

Don’t feel embarrassed, it’s a big shift!

1 Like

Latest update on this. We’re about 2 or so issues away from being ready to receive recipe-requests. Some of the documentation in the repo will need to be updated before we’re ready for publicity.

Recipes are verified via CI and there’s a nice CLI-based user interface via make (mainly thanks to @milesfrain) that helps one easily run each recipe on Node.js and/or the browser from the repo’s root folder.

3 Likes

Cookbook is ready for recipe requests! We’re still figuring out what counts as a “good” recipe, but @milesfrain convinced me to flesh that out later after we have more recipes.

4 Likes

@KarateCowboy Read and print a file’s contents

2 Likes