Although I must have missed the original posting, I felt I'd like to add my
comments to Paul's reply.
"S. Alexander Jacobson" <[EMAIL PROTECTED]> writes:
>> Can someone give a brief comparison of the FRP approach with
>> O'Haskell? Both frameworks seem to revolve around asynchronous
>> interaction between objects in continuous time. The O'Haskell
>> folks argue that you need a new language to express this activity
>> well. The FRP folk seem happy with Haskell as is.
"Paul Hudak" <[EMAIL PROTECTED]> replies:
> I am only vaguely familiar with O'Haskell, and actually did not know
> that it had a notion of reactivity, so I perused:
>
> http://www.cs.chalmers.se/~nordland/ohaskell/survey.html
>
> to find out more. I think it's safe to say that reactivity in O'Haskell
> is very imperative, and tightly coupled to its notion of objects and
> state. You "send messages" to objects to invoke methods that alter
> local state, etc. It looks very much like conventional OO, unless I'm
> missing something. In contrast, reactivity in FRP is much more
> declarative. Stateful things are captured via recursion, or through
> combinators that are analogous to fold, etc. There is very little
> infrastructure to implement FRP; with O'Haskell it looks rather enormous
> (i.e. it is a new language).
O'Haskell actually provides three rather independent additions to Haskell:
- encapsulated state (objects)
- reactive concurrency
- subtyping
Of these it is only the subtyping feature that requires any fundamental
changes to the Haskell core. Objects and reactivity are achieved by means
of a library of primitive monadic constants, just like it is done in
Concurrent Haskell. There is also a layer of syntactic enhancements to
simplify OO programming, including a rather straightforward extension of the
do-syntax. Although admittedly a key OO feature, the subtyping system
should be considered in isolation, and could presumably be of benefit to the
FRAN/FRP style as well.
>> Where does FRP fail such that a new language is required?
>> If the two systems are complimentary, how would FRP be enhanced by
>> O'Haskell?
>
> The two systems and resulting styles of programming are so different
> that I don't know how to answer these questions.
>
> -Paul
I think these kind of questions can only be answered in terms of style and
personal taste. O'Haskell aims at being a bridge between the functional
style and stateful OO programming as it is practiced in e.g. Java, while the
goal of FRP seems to be to lift a purely declarative style to the realm of
interaction. O'Haskell is monad-based, which implies a clear semantic
separation between (non-deterministic) command execution and pure expression
evaluation, whereas the impure features in FRP are confined to a small set
of constants that don't obey the usual equational laws. Whether one likes
one approach over the other is probably governed by previous experiences
with other languages.
However, I think it should be pointed out that the dividing line between
declarative and imperative programming actually goes through Haskell itself,
as it is currently defined. The monadic I/O system has already built a
bridge between the purely functional style and classical, "Pascal-like"
imperative programming. O'Haskell just represents what I believe to be a
natural next step in this direction.
-- Johan