eskimor / purescript-bridge

Create PureScript datatypes from Haskell datatypes
BSD 3-Clause "New" or "Revised" License
110 stars 49 forks source link

`unwrapSingleArguments` switch; improvements to example #53

Closed peterbecich closed 3 years ago

peterbecich commented 3 years ago

This PR adds the unwrapSingleArguments switch: https://github.com/eskimor/purescript-bridge/blob/87d583f337ebf684a2b51ae0df3920163bd0870c/src/Language/PureScript/Bridge/CodeGenSwitches.hs#L26-L30

, corresponding to: https://github.com/paf31/purescript-foreign-generic/blob/46f09996bd54efc146bc1725783789dbac7d6a5b/src/Foreign/Generic/Class.purs#L37-L42

It appears in the generated Purescript: https://github.com/eskimor/purescript-bridge/blob/87d583f337ebf684a2b51ae0df3920163bd0870c/example/src/Types.purs#L23-L26

Some improvements are made to the example. An error is printed if decoding fails.

eskimor commented 3 years ago

Thanks!