How to handle options passed in from JS

I have some records in PS with optional properties (using Maybe). I want to be able to pass in JSON objects from JS (in the browser) without having to mark all those properties null.

I swear I found something a week or two ago that would do this, but I can’t find it now.

What I mean is this:

{ "name": "Bob" }

Becomes:

{ name :: String, age :: Maybe Int }
{ name: "Bob", age: Nothing }

What’s the current best practice for this? I would think that lots of code would need it.

1 Like

Looks good! Thanks. I’ll play around with it.