purescript-contrib / purescript-react

React Bindings for PureScript
MIT License
400 stars 65 forks source link

Add roles declarations to allow safe coercions #175

Closed kl0tl closed 3 years ago

kl0tl commented 4 years ago

This allows terms of type ReactThis props state, ReactClass props, Ref a, RefHandler a and SyntheticEvent_ event to be coerced to type ReactThis props' state', ReactClass props', Ref b, RefHandler b and SyntheticEvent_ event' when Coercible props props', Coercible state state', Coercible a b and Coercible event event' hold, hence allowing the zero cost coerce to introduce and eliminate newtypes in components props and state, refs and their handlers and synthetic events for instance.

JordanMartinez commented 3 years ago

This should build now, but might need to be rebased on top of current main