rescript-react-native / rescript-react-navigation

ReScript bindings for React Navigation
MIT License
74 stars 28 forks source link

Proposal: Rewrite with untagged variants #62

Open mununki opened 1 year ago

mununki commented 1 year ago

Proposal

Rewriting the bindings by the polymorphic variant using the untagged variant in ReScript v11. e.g. https://github.com/rescript-react-native/rescript-react-navigation/blob/main/src/NativeStack.res#L9-L19

Benefit

Using variant versus polymorphic variant gives us more information at compile time, and is more idiomatic.

cknitt commented 1 year ago

With all the new features regarding variants in ReScript 11, I agree that normal variants should be preferred over polymorphic variants for writing new bindings. This was also our philosophy in the new rescript-mui bindings where we make heavy use of untagged variants.

OTOH, for the case of rescript-react-navigation,