9

After reading both this thread and the linked paper, I don't understand how FRP (functional relational programming) is different from (FP) functional programming.

Does FRP augment or replace FP? Can FRP be implemented as a library in an FP language?

1 Answer 1

9

Functional relational programming seems to be, just as the name suggests, a blend of both functional programming and the relational model. I think this sentence pretty much sums it up (p. 42):

In FRP all essential state takes the form of relations, and the essential logic is expressed using relational algebra extended with (pure) user defined functions.

Functional programming removes state from the equation and deals only with pure functions (no side effects). This is supposed to make things easier on everyone by preventing data manipulation from being hidden therefore making it easier to reason about the program. FP is a beautiful ideal but in real life applications state is necessary and often useful. It is of course possible to have state in FP it's just a little more involved.

Based on a quick glance at the paper it seems they're trying to simplify FP by allowing state in a tightly controlled manner. Relational data is well structured and easy to reason about and functional programs are easy to reason about (maybe not in the human sense mind you) so let's augment FP with R and make everyone's state-loving live easier.

5
  • Thanks for the response. Sounds like it's as I expected -- not really meaningfully different from FP. What I couldn't figure out was why a lot of people were implementing their own FRP tools, instead of just extending an FP language.
    – user39685
    Commented Oct 19, 2012 at 13:21
  • @MattFenwick Are you sure you have the right "R" here? There's also Functional Reactive Programming, which is also commonly abbreviated as FRP, and is also a specialization of FP, but is totally unrelated to relational algebra. There are a lot of independent/specialized implementations of FR(eactive)P, but I've never heard of FR(elational)P before. Commented Oct 19, 2012 at 21:48
  • @flame yes, I'm sure. See the linked paper for more details.
    – user39685
    Commented Oct 24, 2012 at 15:07
  • One very interesting language to take a look at is Opa - a functional language that offers mutable state bound to (relational or document) database-records, very direct query-syntax and an extremely powerful type-system. It's not a functional-relational language per se, but it might be a suitable language in which to exercise the idea of functional-relational programming. (don't be fooled by how this is branded as a "JavaScript framework" - it is a compiled and unique language unlike anything else I've seen.) Commented May 9, 2013 at 12:31
  • PS: thank you @axblount, this is an absolutely beautiful answer! Commented May 9, 2013 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.