Skip to content

Learning Yampa and Functional Reactive Programming

Help us, help you! If you are just starting to learn Yampa, please share your experiences! This post just covers my personal opinion on how to tackle Yampa, maybe you have additional or different recommendations.

Update: over the time I wrote some “tutorials” myself, maybe you should start there first

  • Recommendations for learning

    I recommend reading the following papers/presentations to learn Yampa and FRP in general:

    1. A Brief Introduction to Functional Reactive Programming and Yampa (slides)
    2. Arrows, FRP, and Functional Reactive Programming (PPT)
    3. Arrows, Robots and Functional Programming: covers Yampa basics in detail (Section 3 is very domain specific and may be omitted)
    4. Functional Reactive Programming, Continued: more Yampa basics
    5. The Yampa Arcade: standard paper for games
    6. Dynamic, Interactive Virtual Environments: read chapter 3 – Time and appendix A – Functional Reactive Programming
    7. Functional Programming and 3D Games: Yampa basics in games, not very detailed though
    8. Functional Reactive Programming from First Principles: Yampa implementation details
    9. Dynamic Optimization for Functional Reactive Programming: Yampa optimization details

    Understanding FRP

    I think to learn FRP (for games) you have to especially understand the following aspects:

    • Signals make time omnipresent.
    • Systems are built with Signal Functions (SF a b).
    • FRP is implemented in standard Haskell.
    • Arrow notation makes using FRP convenient and more readable.
    • Signal functions diagrams look just mirrored to the actual arrow notation code :)
    • The signal function systems need to be updated somehow – usually via reactimate.
    • reactimate divides the programm into input IO (sense), the signal function (SF) and output IO (actuate).
    • Switches allow dynamic changes of the reactive system. Note that in Yampa signal functions are continuation-based so they “switch into” a new signal function.
    • To handle dynamic game object collections use the delayed parallel switch (dpSwitch) signal function.
    • Input events are propagated to the objects via route.
    • routealso reasons about the whole object collection to produce logical events (f.e. hit detection).
    • killOrSpawn collects all kill and spawn events into one big function composition (insertion/deletion) which is applied to the object collection.
    • In the Space Invaders example gameCore :: IL Object -> SF (GameInput, IL ObjOutput) (IL ObjOutput) is actually embedded in the function core :: ... -> SF GameInput (IL ObjOutput) which acts as the intermediate between sense and actuate.

    Complete list of recommended papers

    Covering FRP in general and FRP in games:

    List of discarded papers

    The reason for discarding was mostly because they are too old, too theoretical or off-topic from games:

    • A Functional Reactive Animation Of A Lift Using Fran
    • A Language for Declarative Robotic Programming
    • Crafting Game-Models Using Reactive System Design
    • Event-Driven FRP
    • FrTime – A Language for Reactive Programs
    • Functional Reactive Animation
    • Functional Reactive Programming for Real-Time Reactive Systems
    • Genuinely Functional User Interfaces
    • Interactive Functional Objects in Clean
    • Modelling Reactive Multimedia – Events and Behaviours
    • Modular Domain Specific Languages and Tools
    • Prototyping Real-Time Vision Systems
    • Reactive Multimedia Documents in a Functional Framework
    • Real-Time FRP

    Tagged with , , .

    12 Responses

    Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

    1. taotree says

      You asked for experiences in learning AFRP so I’ll give it. I went through these papers. They were interesting but lack the most crucial thing in learning to apply AFRP–there’s no tutorial among them!

      I think the most valuable thing, and apparently non-existent, is a tutorial that walks one through building their first AFRP program. The papers are nice, but really need a tutorial.

      After writing this, I see that’s getting there, though something a little simpler would be nice to start. Where’s the “Hello, World” of AFRP :)

      Ah, this! That is great for learning. Excellent. You should link to these two posts of yours at least in trying to help people learn it.

      I think more tutorials would be of great help.

    2. Gerold Meisinger says

      done. thank you for pointing me to these great tutorials.

    3. Snark1994 says

      Your link to “Arrows, Robots and Functional Programming” is broken – still has a copy.

    4. Snark1994 says

      And “Functional Reactive Programming, continued” is now at

    5. dollar general sweepstakes says

      What’s Happening i’m new to this, I stumbled upon this I have discovered It absolutely
      useful and it has aided me out loads. I am hoping
      to contribute & aid different customers like its helped me.
      Great job.

    6. lidstraffung says

      I do trust all the concepts you’ve presented in your post.
      They’re really convincing and can definitely
      work. Nonetheless, the posts are very brief for beginners.
      May you please prolong them a bit from subsequent time?
      Thank you for the post.

    7. ช่างถ่ายวีดีโอ says

      Greetings! Quick question that’s totally off topic.
      Do you know how to make your site mobile friendly?
      My weblog looks weird when browsing from my iphone.

      I’m trying to find a theme or plugin that might
      be able to correct this problem. If you have any suggestions, please share.
      With thanks!

    8. goa tour packages says

      If some one needs expert view about blogging afterward i
      propose him/her to visit this blog, Keep up the nice work.

    9. Artificial flowers UK says

      Great items from you, man. I’ve consider your tuff previous to and you’re simply too wonderful.
      I actually like what you have obtained right here,
      really like what you’re saying and the way by which
      you assert it. You are making it enjoyable aand you
      still take care of to keep it smart. I cant wait to learn far more from you.

      That is really a wonderful website.

    10. pronosticos de baloncesto says

      No lo creo Como puede existir peña tan estupids ? Es asqueroso

    11. Anneliese says

      I am actually thankful to the holder of this web page who has shared
      this enormous paragraph at at this time.

    12. says

      These are genuinely fantastic ideas in about blogging.
      You havfe touched some pleasant factors here. Any waay keep up wrinting.

    Some HTML is OK

    or, reply to this post via trackback.