Playing with FRP - Yampa

I looked into Android and even Windows 7 mobile, they both only reached Hong Kong so far.

Well as long as Apple is the only post office in town, i'm still apple's bitch.

Anyway...

Trying to use functional reactive programming without understanding wtf it is for. The end result is that, yes it works, but not how it's supposed to be used.

FRP is a DSL for signal functions, if you are not writing signal functions (like me), then you should not use it.

I think there's a problem with frp's approach, that is, the abstraction is too primitive and not flexible enough. My understand of FRP is that you define 2 endpoints, then you construct signal function to connect them.

This is exactly both it's strength and weakness.

The good

  • Haskell is strongly typed, so both endpoints are well defined and expressive. They are not just pointers to a specific primitive value. End points can be anything (though should be strict to prevent memory leaks). This makes defining signal functions flexible and efficient (in terms of programming)
  • The arrow syntax helps abstract out the time factor of signal functions
  • Primitive combinators help prevent memory leaks

The not so good (imoo)

  • The abstraction is so frikkin odd.
  • Yes, I understand it can be used to program a robot. But see, robots are like the stone age of programming. Robot algorithms have difficulties maintaining states, and it's gonna be a nightmare to write any backtracking algorithm with frp. The point is that FRP is really limited outside the scope of, say, very simple simulation. I strongly hope and try to believe I'm wrong, but I've yet to find any evidence. The frag code uses FRP, I read it. If i'm not mistaken, the logic is like ridiculously simple:

Map inputs to object positions and well yeah some other attributes and some simple check like collision, and that's it.

  • Yes, the integration over time to calculate position is very elegant, but that's like the only good use of frp I see :)

The fact that I can't find a good use of frp outside of simple demonstration means, well, nothing. Euterpea makes heavy use of signal function and it's really fucking awesome.

Anyway, since this stupid app I'm working on is already hooked with Yampa's code, I'm too lazy to remove it. Will report more when I find something more interesting :)

blog comments powered by Disqus