From 23fd7f5517da8374d01a91b858667ea604b1a3af Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Mon, 7 Aug 2023 20:26:51 -0700 Subject: [PATCH 01/14] yampa: Enable expose-core flag. Refs #274. Re-introduce flag expose-core to control whether the module FRP.Yampa.InternalCore should be exposed. This reverts commit bc713440e3ee2a20cdbf5b94fb5156378e29fa7b. --- yampa/Yampa.cabal | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/yampa/Yampa.cabal b/yampa/Yampa.cabal index ddb48b2f..0a630dc7 100644 --- a/yampa/Yampa.cabal +++ b/yampa/Yampa.cabal @@ -72,6 +72,24 @@ flag examples default: False manual: True +-- WARNING: The following flag exposes Yampa's core. You should avoid using +-- this at all. The only reason to expose it is that we are using Yampa for +-- research, and many extensions require that we expose the constructors. No +-- released project should depend on this. In general, you should always +-- install Yampa with this flag disabled. +flag expose-core + description: + You can enable exposing some of Yampa's core constructs using + -fexpose-core. + . + Enabling this is an unsupported configuration, but it may be useful if you + are building an extension of Yampa for research and do not wish to fork + Yampa completely. + . + No released project should ever depend on this. + default: False + manual: True + library exposed-modules: @@ -95,7 +113,6 @@ library other-modules: -- Auxiliary (commonly used) types FRP.Yampa.Diagnostics - FRP.Yampa.InternalCore build-depends: base < 6 @@ -117,6 +134,14 @@ library build-depends: fail == 4.9.* + if flag(expose-core) + exposed-modules: + FRP.Yampa.InternalCore + else + other-modules: + FRP.Yampa.InternalCore + + test-suite hlint type: exitcode-stdio-1.0 From 6518c54a2bbf8f9763003857384a79e7a667f4a9 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 6 Oct 2023 05:28:00 +0000 Subject: [PATCH 02/14] yampa: Define Yampa.FRP.Task.return in terms of pure. Refs #276. The monad instance for Yampa.FRP.Task.Task does not define return in terms of the Applicative pure. This is leading to a warning due to upcoming changes in GHC. The definition is the same as that of pure, so there's no reason not to rely on it. This commit modifies the Monad instance of Yampa.FRP.Task.Task to define return in terms of the Applicative pure. --- yampa/src/FRP/Yampa/Task.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yampa/src/FRP/Yampa/Task.hs b/yampa/src/FRP/Yampa/Task.hs index a88fc269..bde214eb 100644 --- a/yampa/src/FRP/Yampa/Task.hs +++ b/yampa/src/FRP/Yampa/Task.hs @@ -110,7 +110,7 @@ instance Applicative (Task a b) where instance Monad (Task a b) where tk >>= f = Task (\k -> unTask tk (\c -> unTask (f c) k)) - return x = Task (\k -> k x) + return = pure -- Let's check the monad laws: -- From 0bfed34a534d6bf8674572a63dfaefd74a98ef10 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 6 Oct 2023 05:29:54 +0000 Subject: [PATCH 03/14] yampa: Document changes in CHANGELOG. Refs #276. --- yampa/CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yampa/CHANGELOG b/yampa/CHANGELOG index 9698211a..bbc7c210 100644 --- a/yampa/CHANGELOG +++ b/yampa/CHANGELOG @@ -1,3 +1,6 @@ +2023-10-05 Ivan Perez + * Define Yampa.FRP.Task.return in terms of pure (#276). + 2023-08-07 Ivan Perez * Version bump (0.14.4) (#274). * Introduce benchmark (#167). From 944127328cda27e1d694c03c5a814b7fbd2b8b85 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 6 Oct 2023 05:58:46 +0000 Subject: [PATCH 04/14] yampa: Add link to new publication. Refs #277. A new paper "The beauty and elegance of Functional Reactive Animation" was published as part of FARM 2023 / ICFP 2023. This commit adds a link to the README that is authorized to access the paper. --- yampa/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/yampa/README.md b/yampa/README.md index 5eb4b0b1..fc17639d 100644 --- a/yampa/README.md +++ b/yampa/README.md @@ -351,6 +351,7 @@ Documentation is also available in the ## Publications [(Back to top)](#table-of-contents) +* [The Beauty and Elegance of Functional Reactive Animation](https://dl.acm.org/doi/10.1145/3609023.3609806?cid=99658741366) (Ivan Perez; 2023) * [Extensible and Robust Functional Reactive Programming](http://www.cs.nott.ac.uk/~psxip1/papers/2017-Perez-thesis-latest.pdf) (Ivan Perez; 2017) * [Testing and Debugging Functional Reactive Programming](http://dl.acm.org/authorize?N46564) (Ivan Perez and Henrik Nilsson; 2017) * [Functional Reactive Programming, Refactored](http://dl.acm.org/authorize?N34896) (Ivan Perez, Manuel Bärenz, and Henrik Nilsson; 2016) From b385459136efea88b8660a802ee255941f2fb478 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 6 Oct 2023 06:00:08 +0000 Subject: [PATCH 05/14] yampa: Document changes in CHANGELOG. Refs #277. --- yampa/CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/yampa/CHANGELOG b/yampa/CHANGELOG index bbc7c210..a60f8833 100644 --- a/yampa/CHANGELOG +++ b/yampa/CHANGELOG @@ -1,5 +1,6 @@ 2023-10-05 Ivan Perez * Define Yampa.FRP.Task.return in terms of pure (#276). + * Add link to new publication (#277). 2023-08-07 Ivan Perez * Version bump (0.14.4) (#274). From b18a942ffe5bda7f6f1552712af8a9069c32efb7 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sat, 7 Oct 2023 19:41:05 +0000 Subject: [PATCH 06/14] yampa: Make FRP.Yampa.Event.maybeToEvent public. Refs #267. The function FRP.Yampa.Event.maybeToEvent is labelled as internal, yet it is being exported by the module. The function is useful and is being used in the wild, so removing it now would break existing applications. This commit makes the function "officially" public. It changes the comment stating that it is internal, and it moves it within the module to a location that makes more sense in terms of explaining the API. --- yampa/src/FRP/Yampa/Event.hs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/yampa/src/FRP/Yampa/Event.hs b/yampa/src/FRP/Yampa/Event.hs index 0cbf6897..4b4fb566 100644 --- a/yampa/src/FRP/Yampa/Event.hs +++ b/yampa/src/FRP/Yampa/Event.hs @@ -35,9 +35,6 @@ module FRP.Yampa.Event , noEventFst , noEventSnd - -- * Internal utilities for event construction - , maybeToEvent - -- * Utility functions similar to those available for Maybe , event , fromEvent @@ -64,6 +61,10 @@ module FRP.Yampa.Event , filterE , mapFilterE , gate + + -- * Utilities for easy event construction + , maybeToEvent + ) where @@ -167,16 +168,6 @@ instance NFData a => NFData (Event a) where rnf NoEvent = () rnf (Event a) = rnf a `seq` () --- * Internal utilities for event construction - --- These utilities are to be considered strictly internal to Yampa for the time --- being. - --- | Convert a maybe value into a event ('Event' is isomorphic to 'Maybe'). -maybeToEvent :: Maybe a -> Event a -maybeToEvent Nothing = NoEvent -maybeToEvent (Just a) = Event a - -- * Utility functions similar to those available for Maybe -- | An event-based version of the maybe function. @@ -304,3 +295,10 @@ mapFilterE f e = e >>= (maybeToEvent . f) gate :: Event a -> Bool -> Event a _ `gate` False = NoEvent e `gate` True = e + +-- * Utilities for easy event construction + +-- | Convert a maybe value into a event ('Event' is isomorphic to 'Maybe'). +maybeToEvent :: Maybe a -> Event a +maybeToEvent Nothing = NoEvent +maybeToEvent (Just a) = Event a From 5a12bd168717220458b91b2639f8b904b72a5f54 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sat, 7 Oct 2023 19:44:12 +0000 Subject: [PATCH 07/14] yampa-test: Move test for consistency with module tested. Refs #267. A prior commit moved the function FRP.Yampa.Event.maybeToEvent within its module to a location that made more sense in terms of explaining the API. This commit moves the accompanying test in yampa-test, so that the test module remains consistent with the module it tests. --- yampa-test/tests/Test/FRP/Yampa/Event.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/yampa-test/tests/Test/FRP/Yampa/Event.hs b/yampa-test/tests/Test/FRP/Yampa/Event.hs index 6453eed9..9e56716f 100644 --- a/yampa-test/tests/Test/FRP/Yampa/Event.hs +++ b/yampa-test/tests/Test/FRP/Yampa/Event.hs @@ -38,7 +38,6 @@ tests = testGroup "Regression tests for FRP.Yampa.Event" , testApplicative , testMonad , testAlternative - , testProperty "maybeToEvent" testMaybeToEvent , testEvent , testProperty "fromEvent" testFromEvent , testProperty "isEvent" testIsEvent @@ -58,6 +57,7 @@ tests = testGroup "Regression tests for FRP.Yampa.Event" , testProperty "filterE" testFilterE , testProperty "mapFilterE" testMapFilterE , testProperty "gate" testGate + , testProperty "maybeToEvent" testMaybeToEvent ] -- * The Event type @@ -227,14 +227,6 @@ testAlternative = testGroup "alternative" testAlternativeEmptyIdRight = forAll randomEvent $ \e -> (e <|> noEvent ) == e - --- * Internal utilities for event construction - --- | maybeToEvent -testMaybeToEvent :: Property -testMaybeToEvent = - forAll randomMaybe $ \m -> - event Nothing Just (maybeToEvent m) == m -- * Utility functions similar to those available for Maybe -- | event @@ -438,6 +430,14 @@ testGate = forAll randomBool $ \b -> gate e b == filterE (const b) e +-- * Utilities for easy event construction + +-- | maybeToEvent +testMaybeToEvent :: Property +testMaybeToEvent = + forAll randomMaybe $ \m -> + event Nothing Just (maybeToEvent m) == m + -- * Arbitrary value generation instance Arbitrary a => Arbitrary (Event a) where From e7abdd278c9737a02893e42c77c06417602351ae Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sat, 7 Oct 2023 19:46:45 +0000 Subject: [PATCH 08/14] yampa: Document changes in CHANGELOG. Refs #267. --- yampa/CHANGELOG | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yampa/CHANGELOG b/yampa/CHANGELOG index a60f8833..dc00d1be 100644 --- a/yampa/CHANGELOG +++ b/yampa/CHANGELOG @@ -1,6 +1,7 @@ -2023-10-05 Ivan Perez +2023-10-07 Ivan Perez * Define Yampa.FRP.Task.return in terms of pure (#276). * Add link to new publication (#277). + * Make FRP.Yampa.Event.maybeToEvent public (#267). 2023-08-07 Ivan Perez * Version bump (0.14.4) (#274). From 9c029b93593be401b7c4591c9f5d1807ab1d345d Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sat, 7 Oct 2023 19:47:21 +0000 Subject: [PATCH 09/14] yampa-test: Document changes in CHANGELOG. Refs #267. --- yampa-test/CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yampa-test/CHANGELOG b/yampa-test/CHANGELOG index 562252af..7a65bd3e 100644 --- a/yampa-test/CHANGELOG +++ b/yampa-test/CHANGELOG @@ -1,3 +1,6 @@ +2023-10-07 Ivan Perez + * Move test for consistency with module tested (#267). + 2023-08-07 Ivan Perez * Version bump (0.14.4) (#274). * Add version bounds to dependencies (#273). From 7c5e4869361a91a6bbb123bad855234644c550c9 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sat, 8 Apr 2023 04:00:23 +0000 Subject: [PATCH 10/14] yampa: Disable flag before release. Refs #278. The internal-core flag exposes Yampa's internals. This kind of facility is discouraged by hackage. This commit removes that flag altogether before the upload to hackage. --- yampa/Yampa.cabal | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/yampa/Yampa.cabal b/yampa/Yampa.cabal index 0a630dc7..ddb48b2f 100644 --- a/yampa/Yampa.cabal +++ b/yampa/Yampa.cabal @@ -72,24 +72,6 @@ flag examples default: False manual: True --- WARNING: The following flag exposes Yampa's core. You should avoid using --- this at all. The only reason to expose it is that we are using Yampa for --- research, and many extensions require that we expose the constructors. No --- released project should depend on this. In general, you should always --- install Yampa with this flag disabled. -flag expose-core - description: - You can enable exposing some of Yampa's core constructs using - -fexpose-core. - . - Enabling this is an unsupported configuration, but it may be useful if you - are building an extension of Yampa for research and do not wish to fork - Yampa completely. - . - No released project should ever depend on this. - default: False - manual: True - library exposed-modules: @@ -113,6 +95,7 @@ library other-modules: -- Auxiliary (commonly used) types FRP.Yampa.Diagnostics + FRP.Yampa.InternalCore build-depends: base < 6 @@ -134,14 +117,6 @@ library build-depends: fail == 4.9.* - if flag(expose-core) - exposed-modules: - FRP.Yampa.InternalCore - else - other-modules: - FRP.Yampa.InternalCore - - test-suite hlint type: exitcode-stdio-1.0 From d164fefb36dec5ec5000b1a3abdc1daa0eefaaa2 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Tue, 8 Aug 2023 03:12:54 +0000 Subject: [PATCH 11/14] yampa: Version bump (0.14.5). Refs #278. --- yampa/Yampa.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yampa/Yampa.cabal b/yampa/Yampa.cabal index ddb48b2f..92d4f860 100644 --- a/yampa/Yampa.cabal +++ b/yampa/Yampa.cabal @@ -30,7 +30,7 @@ cabal-version: >= 1.10 build-type: Simple name: Yampa -version: 0.14.4 +version: 0.14.5 author: Henrik Nilsson, Antony Courtney maintainer: Ivan Perez (ivan.perez@keera.co.uk) homepage: https://github.com/ivanperez-keera/Yampa/ From c02bd5a700dc84407ee0d6c7b21347ae0e45fd23 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sun, 8 Oct 2023 00:01:35 +0000 Subject: [PATCH 12/14] yampa-test: Version bump (0.14.5). Refs #278. --- yampa-test/yampa-test.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yampa-test/yampa-test.cabal b/yampa-test/yampa-test.cabal index 4642a8c6..25ed37a4 100644 --- a/yampa-test/yampa-test.cabal +++ b/yampa-test/yampa-test.cabal @@ -31,7 +31,7 @@ cabal-version: >= 1.10 build-type: Simple name: yampa-test -version: 0.14.4 +version: 0.14.5 author: Ivan Perez maintainer: ivan.perez@keera.co.uk homepage: http://github.com/ivanperez-keera/Yampa @@ -84,7 +84,7 @@ library base >= 4 && < 5 , normaldistribution >= 1.1.0.1 && < 1.2 , QuickCheck >= 2.12 && < 2.15 - , Yampa >= 0.14.4 && < 0.15 + , Yampa >= 0.14.5 && < 0.15 default-language: Haskell2010 From 2300eba1cb21f39f70a32c453ee87dea5a4f9feb Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sun, 8 Oct 2023 00:02:22 +0000 Subject: [PATCH 13/14] yampa: Document changes in CHANGELOG. Refs #278. --- yampa/CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/yampa/CHANGELOG b/yampa/CHANGELOG index dc00d1be..fe7a8d0b 100644 --- a/yampa/CHANGELOG +++ b/yampa/CHANGELOG @@ -1,4 +1,5 @@ 2023-10-07 Ivan Perez + * Version bump (0.14.5) (#278). * Define Yampa.FRP.Task.return in terms of pure (#276). * Add link to new publication (#277). * Make FRP.Yampa.Event.maybeToEvent public (#267). From 977932e6d06a569d251ee60e4e2bfdccda506d48 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sun, 8 Oct 2023 00:02:41 +0000 Subject: [PATCH 14/14] yampa-test: Document changes in CHANGELOG. Refs #278. --- yampa-test/CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/yampa-test/CHANGELOG b/yampa-test/CHANGELOG index 7a65bd3e..42bac024 100644 --- a/yampa-test/CHANGELOG +++ b/yampa-test/CHANGELOG @@ -1,4 +1,5 @@ 2023-10-07 Ivan Perez + * Version bump (0.14.5) (#278). * Move test for consistency with module tested (#267). 2023-08-07 Ivan Perez