PureScript for Elm developers

Hi there! I come from Elm, and I made a cheat-sheet for myself when learning PureScript. Now I’m sharing it: GitHub - laurentpayot/purescript-for-elm-developers: PureScript crash course targeted at Elm developers. Any feedback is welcome :smiley:



Nice - only minor comments but here are a few things I noticed:

  • I think lists are rarely used in PureScript (at least I don’t) - Arrays everywhere :wink: - so I’d concentrate on that.
  • Halogen does not come with a router just like the others (or I’m stupid and am doing it the wrong way for the last few years :wink: … no really: If I’m wrong please tell me)
  • Components in Halogen are great and with halogen-store you’ll probably get a instant happiness boost if you struggled with keeping global state and managing sub-state (yeah components) with Elm - so if you don’t buy into “you don’t need what we don’t have anyway” :wink:

There are additional type classes that can be derived as of purs@0.15.8. They were added in 0.15.7 but .8 fixed a related issue: Release v0.15.7 · purescript/purescript · GitHub

I think : cannot be used in pattern matching but I could be wrong…?

case xs of
  x : rest -> ... -- head and tail

NonEmpty Array a vs NonEmptyArray a: use the latter where possible.

Mind submitting a PR to my learning repo, linking to your cheatsheet somewhere in here? Other Important Info - PureScript: Jordan's Reference

1 Like

Thanks @CarstenKoenig for your feedback :slightly_smiling_face:

I added a note about that.

I added a note about routing for the 3 frameworks I talk about

Also added halogen-store to the component line of Halogen.

Thanks again!

Thanks a lot for your feedback @JordanMartinez :slightly_smiling_face:
I will make changes about your comments tonight or tomorrow, and will submit a PR to your learning repo too :wink:

Added them.

I guess the resource I read about array destructuring was pre-PureScript 0.7. I added a whole section about pattern matching for arrays of a fixed length and uncons/unsnoc when they have undetermined length (thanks to @i-am-the-slime from Discord).

I rewrote the NonEmpty section for that.

PR done.

Thanks for sharing!
My modest feedback :

  • a mention of Data.Tuple.Nested ((/\)) and Data.Tuple.Nested (type (/\))
  • a mention of Pursuit
  • a mention of Data.Foldable where one would find sum, product, maximum, …


1 Like

Thank you @Ebmtranceboy for your great feedback :slight_smile: I will try to do this next week and I will let you know.

  • Nested tuples section added
  • Pursuit note added
  • Foldables section added

Each of these were really missing. Thanks again @Ebmtranceboy :+1:

1 Like

By the way @JordanMartinez, I realized I didn’t give you credits for the module example I shamelessly ripped off from your reference. Thank you so much for your amazing work.

I mean… your repo does say:

This README file is a crash course on PureScript targeted at Elm developers. It is based on information picked from:

Sometimes I did a shameless copy-paste instead of writing a bad paraphrase. I think it is fair use but please let me know if I am infringing any copyright. Feel free to open an issue if you find a mistake.

And I thought… Meh. I don’t have an issue with that particular usage :smile:

1 Like