Open miguel-negrao opened 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?
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...
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.
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 ?
This PR contains two packages:
essence-of-live-coding-frp is a port of Bearriver for essence-of-live-coding.
Notable changes from Bearriver:
Cell m a b
, cells which do are of typeCell (ClockInfoT m) a b
.runClockInfoC :: MonadIO m => Cell (ClockInfoT m) a b -> Cell m a b
.essence-of-live-coding
, but I think that if this is merged then the time related stuff inessence-of-live-coding
should be removed. Possibly the functionedge
might not be needed in eolc, and there is a nameclash with the functiononce
.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.
evalT
was implemented in yampa-test and the way some functions are defined in Bearriver break the test suite. I reimplemented evalT directly in terms of functions from eolc. I hope/believe that my re-implementation is correct. I tested with some tautologies from LTL and they hold. Obviously a subtle bug might have been missed.Additional info:
Traversing
instance forCell
therefore it goes on top of my PR which introduces that instance.