bodil / purescript-signal

Elm style FRP library for PureScript
Apache License 2.0
258 stars 44 forks source link

Why isn't get() exposed? #58

Closed MichaelXavier closed 6 years ago

MichaelXavier commented 7 years ago

I'm curious why there is no equivalent of get on the purescript side of Signal. Because signals must always have values, it seems like you could have getSignal :: forall e a. Signal a -> Eff e a. I've once or twice had use for something like this and hesitated to implement it myself with FFI.

bodil commented 7 years ago

Simply because there's no equivalent in the Elm original. I'd accept a PR to add it. (And you should definitely not attempt it with FFI, the JS side API is very much not guaranteed to remain stable.)

MichaelXavier commented 7 years ago

I may give it a try, although I think when I looked last FFI was the only option as the PS API did not make it possible to implement.

bodil commented 7 years ago

I mean, you should never try to get the value using FFI from your own application. Relying on the implementation inside purescript-signal is of course OK, there's no other way to do it.