diff --git a/yampa-test/CHANGELOG b/yampa-test/CHANGELOG index 562252af..42bac024 100644 --- a/yampa-test/CHANGELOG +++ b/yampa-test/CHANGELOG @@ -1,3 +1,7 @@ +2023-10-07 Ivan Perez + * Version bump (0.14.5) (#278). + * 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). 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 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 diff --git a/yampa/CHANGELOG b/yampa/CHANGELOG index 9698211a..fe7a8d0b 100644 --- a/yampa/CHANGELOG +++ b/yampa/CHANGELOG @@ -1,3 +1,9 @@ +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). + 2023-08-07 Ivan Perez * Version bump (0.14.4) (#274). * Introduce benchmark (#167). 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) 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/ 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 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: --