Take the 2-minute tour ×

While reading about and implementing FRP I am confused by the semantics of the occs function on Event (referred to in Conal Elliott's papers). It is very simple when dealing with static (pure) Events but I don't understand how it works with dynamic Events (such as mouse button presses etc). For instance, if occs returns all of the occurrences of an Event then as far as I can see a result for occs for a dynamic Event could be one of the following things (since not all occurrences are known yet):

  • The known occurrences at the time of the call
  • An array/list that is automatically kept up to date with the Event itself

Of course both of these seem slightly ugly - one breaks semantic purity and the other involves side effects.

Would it be better to simply remove the occs function outside of the FRP framework itself (ie make it private to Event and anything that extends it)? As long as Event has map, filter, merge etc functions that return further Events I feel it could be lost without trouble. Or, am I misunderstanding something?

share|improve this question
Please don't downvote and then not explain why. It really doesn't help. –  seadowg Feb 14 '12 at 16:30

1 Answer 1

up vote 2 down vote accepted

As far as I understand the occs function mentioned in Conal's paper is not part of the API. Rather, it's a specification of the programming model. Conal uses it to describe the semantics of the various combinators, but it's not something that you can or should implement.

share|improve this answer
I had thought this might be the case but really wanted to check with someone. Thanks Heinrich! –  seadowg Feb 16 '12 at 12:43
My pleasure. :) –  Heinrich Apfelmus Feb 17 '12 at 8:21

Your Answer


