joelburget / react-haskell

React bindings for Haskell
MIT License
351 stars 26 forks source link

Functor instance for ReactNode #22

Closed bergey closed 9 years ago

bergey commented 9 years ago

It looks as though ReactNode admits a Functor instance, which would use LocalNode but pick the insig -> sig function at the use site, rather than a type-based default. Is there a reason this instance is not provided? Would you accept a PR?

The Functor laws aren't exactly obeyed, because you can count how many times fmap has been applied. I'm not sure this matters, since the constructors aren't exported. I'd be fine with some sigMap though, with the same type but without the laws.

joelburget commented 9 years ago

Is there a reason this instance is not provided?

I just haven't needed it. Actually, I'm curious what you plan to use it for.

Would you accept a PR?

Absolutely.

Let's start with sigMap, since, as you say, the laws are not followed. After that, will think about making a Functor instance.