turion / essence-of-live-coding

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

Add changes #90

Closed miguel-negrao closed 2 years ago

miguel-negrao commented 2 years ago

I've placed changes next to hold as I think it as has a relationship to hold, since the following holds:

inputs ===  fst (runIdentity $ steps (changes >>> hold (head inputs)) inputs

So changes >>> hold a is similar to identity.

turion commented 2 years ago

I've placed changes next to hold as I think it as has a relationship to hold, since the following holds:

inputs ===  fst (runIdentity $ steps (changes >>> hold (head inputs)) inputs

So changes >>> hold a is similar to identity.

Cool, if this holds, could you add a test?

miguel-negrao commented 2 years ago

Cool, if this holds, could you add a test?

The test for that property was already in the PR, it's in essence-of-live-coding/test/Cell/Util.hs . It has 3 tests in total.

miguel-negrao commented 2 years ago

The property can also be stated as delay a >>> changes >>> hold a == delay a, maybe I should change the test and the haddock to state it like this ?

, testProperty "delay a >>> changes >>> hold a == delay a"
    $ \(inputs :: [Int]) (startValue :: Int) -> fst (runIdentity $ steps (delay startValue) inputs) === 
        fst (runIdentity $ steps (delay startValue >>> changes >>> hold startValue) inputs)

This test passes.

miguel-negrao commented 2 years ago

Ok, changed the test and haddock to delay a >>> changes >>> hold a == delay a

miguel-negrao commented 2 years ago

Incorporated your suggestions, thanks for the review ! :)

turion commented 2 years ago

Let's merge https://github.com/turion/essence-of-live-coding/pull/91/ first though, so we can test the changes on the new CI :sparkles:

turion commented 2 years ago

Ok, can you rebase, then the CI will run thanks to your previous PR :tada:

miguel-negrao commented 2 years ago

I think this is ok to merge, right ?

turion commented 2 years ago

Yes, I lost track, sorry.