turion / essence-of-live-coding

Universal Live Coding & Functional Reactive Programming Framework
https://www.manuelbaerenz.de/#computerscience
64 stars 6 forks source link

essence-of-live-coding-frp: Continuous time FRP with eolc #102

Open miguel-negrao opened 2 years ago

miguel-negrao commented 2 years ago

This PR contains two packages:

essence-of-live-coding-frp is a port of Bearriver for essence-of-live-coding.

Notable changes from Bearriver:

Additionally I added a package essence-of-live-coding-frp-test which implements a Linear Temporal Logic approach to testing FRP, porting the code from the yampa-test package. Some of the tests are ported from that package, but many were created by myself. This is a separate package so that other packages can test their own code using this package. This is due to my assumption that you cannot import library code from a test suite of another package, and it also follows the fact that yampa-test is a separate package from Yampa.

Additional info:

turion commented 2 years ago

Thanks a lot! This is a huge contribution, I'll have to come back to it later. If you want to speed it up, maybe we can split it into only the FRP part and the test part?

miguel-negrao commented 2 years ago

Thanks a lot! This is a huge contribution, I'll have to come back to it later. If you want to speed it up, maybe we can split it into only the FRP part and the test part?

My pleasure ! :-) Sure, I can do that. So I would do one PR just with the FRP part and another PR (on top of the previous one) with the test stuff ?

Today I was working on my GUI code, and I started wondering if

accum :: (Monad m, Data a) => a -> Cell m (Maybe (a -> a)) (Maybe a)

and similar functions should be generalized to

accum :: (Monad m, Data a, Traversable f) => a -> Cell m (f (a -> a)) (f a)

Such that it can either deal with events in the usual sense (Maybe e), or with lists of events ( [e]). This is relevant for instant when merging events from different sources to be fed into accum. If we want to take just one event then we would use Maybe e, but if want to group possible simultaneous events then we can use [e], and the function accum can deal with both just fine since it is defined as traverse' . accumB. To me it makes more sense to use the general type signature, although for newcomers it will be harder to understand what it does...

miguel-negrao commented 2 years ago

I've split this into two PRs. This one only has the frp library, the test part will go into another PR. Also I've generalized the functions that use traverse' and fixed the documentation issues you mentioned.

miguel-negrao commented 2 years ago

I'm not particularly interested in using or porting Yampa-based code, so I don't feel the need keep the same API. I'm fine with nº2 as long as we have all the required combinators to deal with events and continuous time. Do you have some examples of operators you would want to remove ?