From fda5c1ed05f9202097b6eb36e08df306a4f74d40 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Mon, 7 Aug 2023 20:26:51 -0700 Subject: [PATCH 01/13] yampa: Enable expose-core flag. Refs #278. Re-introduce flag expose-core to control whether the module FRP.Yampa.InternalCore should be exposed. This reverts commit 7c5e4869361a91a6bbb123bad855234644c550c9. --- yampa/Yampa.cabal | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/yampa/Yampa.cabal b/yampa/Yampa.cabal index 92d4f860..9e272f73 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 0dec61e158c88a8b8e8a09e242aeae781627384e Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sun, 3 Dec 2023 03:05:19 +0000 Subject: [PATCH 02/13] yampa: Document HTML + WebAssembly backend in README. Refs #34. Document the existence of an example that uses GHC's new WebAssembly backend to create an interactive Yampa animation. --- yampa/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/yampa/README.md b/yampa/README.md index fc17639d..4c6b4dda 100644 --- a/yampa/README.md +++ b/yampa/README.md @@ -311,6 +311,7 @@ want. Existing backends include: * WX (see wxHaskell) * HTML Canvas via JS Dom (for an example, see [haskanoid's GHCJS branch](https://github.com/ivanperez-keera/haskanoid/blob/ghcjs/src/Display.hs)) * HTML5 Canvas via blank-canvas (see [yampa-canvas](https://github.com/ku-fpg/yampa-canvas)) +* HTML5 with Web Assembly (Wasm) (for an example, see [yampa-wasm-example](https://github.com/AntanasKal/yampa-wasm-example)) * Gloss (see [yampa-gloss](https://github.com/ivanperez-keera/yampa-gloss)) * Diagrams (see [diagrams example](https://github.com/ivanperez-keera/Yampa/blob/develop/yampa/examples/Diagrams.hs)) * [Keera Hails](https://github.com/keera-studios/keera-hails/tree/master/keera-hails-reactive-yampa) (reactive programming framework with GTK, WX, Qt, Android, iOS and HTML support). From 3ea4892f9592068086450dea6c8cf24ded7cedd2 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sun, 3 Dec 2023 03:08:33 +0000 Subject: [PATCH 03/13] yampa: Document changes in CHANGELOG. Refs #34. --- yampa/CHANGELOG | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yampa/CHANGELOG b/yampa/CHANGELOG index fe7a8d0b..397ad252 100644 --- a/yampa/CHANGELOG +++ b/yampa/CHANGELOG @@ -1,3 +1,7 @@ +2023-12-02 Ivan Perez + * Document HTML + WebAssembly backend in README (#34). + * Thanks to @AntanasKal. + 2023-10-07 Ivan Perez * Version bump (0.14.5) (#278). * Define Yampa.FRP.Task.return in terms of pure (#276). From b677bbc1d3e6a2a0e78c1cdcd51f48ecd54b47c9 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 8 Dec 2023 06:20:13 +0000 Subject: [PATCH 04/13] yampa: Relax version bounds on deepseq. Refs #280. Yampa fails to compile with GHC 9.8, due to a constraint in the cabal file requiring deepseq < 1.5.0.0, when the version included with GHC 9.8 is precisely 1.5.0.0. This commit relaxes the upper version bound on deepseq. With that constraint relaxed, Yampa compiles with GHC 9.8.1 --- yampa/Yampa.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yampa/Yampa.cabal b/yampa/Yampa.cabal index 9e272f73..01288d4c 100644 --- a/yampa/Yampa.cabal +++ b/yampa/Yampa.cabal @@ -117,7 +117,7 @@ library build-depends: base < 6 - , deepseq >= 1.3.0.1 && < 1.5 + , deepseq >= 1.3.0.1 && < 1.6 , random >= 1.1 && < 1.3 , simple-affine-space >= 0.1 && < 0.3 From a812dba158a116ebcda030cf27a174493f2876a1 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 8 Dec 2023 06:29:38 +0000 Subject: [PATCH 05/13] yampa: Document changes in CHANGELOG. Refs #280. --- yampa/CHANGELOG | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yampa/CHANGELOG b/yampa/CHANGELOG index 397ad252..b2eefcf0 100644 --- a/yampa/CHANGELOG +++ b/yampa/CHANGELOG @@ -1,5 +1,6 @@ -2023-12-02 Ivan Perez +2023-12-07 Ivan Perez * Document HTML + WebAssembly backend in README (#34). + * Relax version bounds on deepseq (#280). * Thanks to @AntanasKal. 2023-10-07 Ivan Perez From ac609b0f5af319f7194d77c99a3775853091fb9d Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 8 Dec 2023 07:49:57 +0000 Subject: [PATCH 06/13] yampa: Update instructions in example comment. Refs #281. The diagrams example has outdated documentation (it refers to cabal v1 commands without the prefix), and the definitions are not documented. This commit updates the documentation in the module with the v1-prefixed commands. --- yampa/examples/Diagrams.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yampa/examples/Diagrams.hs b/yampa/examples/Diagrams.hs index 76b4a28c..e765eee9 100644 --- a/yampa/examples/Diagrams.hs +++ b/yampa/examples/Diagrams.hs @@ -13,12 +13,12 @@ -- -- Install diagrams with Cairo support, together with Yampa: -- --- cabal sandbox init --- cabal install Yampa diagrams -fcairo +-- cabal v1-sandbox init +-- cabal v1-install Yampa diagrams diagrams-cairo -- -- Compile in a sandbox with: -- --- cabal exec -- ghc --make examples/Diagrams.hs +-- cabal v1-exec -- ghc --make examples/Diagrams.hs -- -- And run with: -- From 68a7f2e75de79cb7910528815ba9758a92045787 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 8 Dec 2023 07:51:14 +0000 Subject: [PATCH 07/13] yampa: Document diagrams example. Refs #281. This commit adds signatures of all top-level definitions in the Diagrams example, to make it easier to understand. It also adds (minimal) comments to each function, and organizes them in a clearer way within the file. --- yampa/examples/Diagrams.hs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/yampa/examples/Diagrams.hs b/yampa/examples/Diagrams.hs index e765eee9..f46b0cf6 100644 --- a/yampa/examples/Diagrams.hs +++ b/yampa/examples/Diagrams.hs @@ -25,14 +25,17 @@ -- ./examples/Diagrams -w 400 -h 400 -o output.gif import Diagrams.Backend.Cairo.CmdLine -import Diagrams.Prelude +import Diagrams.Prelude hiding (Time) import FRP.Yampa hiding (norm, ( # ), (*^)) +main :: IO () main = mainWith $ take 60 frames +-- | Frames of the animation. frames :: [(Diagram B, Int)] frames = zip ((embed sfVF $ deltaEncode 1 $ repeat ())) (repeat 1) +-- | Signal producing the diagram at a point in time. sfVF :: SF () (Diagram B) sfVF = proc () -> do t <- time -< () @@ -40,16 +43,24 @@ sfVF = proc () -> do <> ( square 3.5 # lw none # alignBL)) returnA -< diag +-- | Field of arrows as it changes over time. +field :: Time -> Diagram B field t = position $ zip points (arrows t) -locs = [(x, y) | x <- [0.1, 0.3 .. 3.25], y <- [0.1, 0.3 .. 3.25]] - +-- | Arrow points as they change over time. +points :: [Point V2 Double] points = map p2 locs -vectorField t (x, y) = r2 (sin (t + y + 1), sin (t + x + 1)) +-- | Arrow locations as they change over time. +locs :: [(Double, Double)] +locs = [(x, y) | x <- [0.1, 0.3 .. 3.25], y <- [0.1, 0.3 .. 3.25]] +-- | Arrows as they change over time. +arrows :: Time -> [Diagram B] arrows t = map (arrowAtPoint t) locs +-- | Diagram of a star at a given point in time and space. +arrowAtPoint :: Time -> (Double, Double) -> Diagram B arrowAtPoint t (x, y) = arrowAt' opts (p2 (x, y)) (sL *^ vf) # alignTL where vf = vectorField t (x, y) @@ -64,3 +75,7 @@ arrowAtPoint t (x, y) = arrowAt' opts (p2 (x, y)) (sL *^ vf) # alignTL opts = (with & arrowHead .~ spike & headLength .~ normalized hs & shaftStyle %~ lwN sW) + +-- | Direction vector depending on the time and the position in space. +vectorField :: Time -> (Double, Double) -> V2 Double +vectorField t (x, y) = r2 (sin (t + y + 1), sin (t + x + 1)) From 0385f51f39a654569f2bb3a1dfb0798977e1b0d8 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 8 Dec 2023 07:53:07 +0000 Subject: [PATCH 08/13] yampa: Document changes in CHANGELOG. Refs #281. --- yampa/CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/yampa/CHANGELOG b/yampa/CHANGELOG index b2eefcf0..868e0544 100644 --- a/yampa/CHANGELOG +++ b/yampa/CHANGELOG @@ -1,6 +1,7 @@ 2023-12-07 Ivan Perez * Document HTML + WebAssembly backend in README (#34). * Relax version bounds on deepseq (#280). + * Update and improve documentation of Diagrams example (#281). * Thanks to @AntanasKal. 2023-10-07 Ivan Perez From 7155134925134609d83fad6f1a1d891cc892cb7d Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sat, 8 Apr 2023 04:00:23 +0000 Subject: [PATCH 09/13] yampa: Disable flag before release. Refs #282. 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 01288d4c..33ee2f7f 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 26cf5892b6344ca4ab38970ec246f6229a32d41a Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 8 Dec 2023 07:58:22 +0000 Subject: [PATCH 10/13] yampa: Version bump (0.14.6). Refs #282. --- yampa/Yampa.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yampa/Yampa.cabal b/yampa/Yampa.cabal index 33ee2f7f..e1778e10 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.5 +version: 0.14.6 author: Henrik Nilsson, Antony Courtney maintainer: Ivan Perez (ivan.perez@keera.co.uk) homepage: https://github.com/ivanperez-keera/Yampa/ From 15031df64ce2dbc9e1f5d22bcb175847a0faece1 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 8 Dec 2023 07:58:53 +0000 Subject: [PATCH 11/13] yampa-test: Version bump (0.14.6). Refs #282. --- 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 25ed37a4..5678a2e3 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.5 +version: 0.14.6 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.5 && < 0.15 + , Yampa >= 0.14.6 && < 0.15 default-language: Haskell2010 From 581e0d6e83dc40000b92d30be2a4765fe5d9c63d Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 8 Dec 2023 07:59:14 +0000 Subject: [PATCH 12/13] yampa: Document changes in CHANGELOG. Refs #282. --- yampa/CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/yampa/CHANGELOG b/yampa/CHANGELOG index 868e0544..bdfb0030 100644 --- a/yampa/CHANGELOG +++ b/yampa/CHANGELOG @@ -1,4 +1,5 @@ 2023-12-07 Ivan Perez + * Version bump (0.14.6) (#282). * Document HTML + WebAssembly backend in README (#34). * Relax version bounds on deepseq (#280). * Update and improve documentation of Diagrams example (#281). From b226d26489437ba11552cfdb83518b3ba4d387e1 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 8 Dec 2023 07:59:34 +0000 Subject: [PATCH 13/13] yampa-test: Document changes in CHANGELOG. Refs #282. --- yampa-test/CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yampa-test/CHANGELOG b/yampa-test/CHANGELOG index 42bac024..70ea900d 100644 --- a/yampa-test/CHANGELOG +++ b/yampa-test/CHANGELOG @@ -1,3 +1,6 @@ +2023-12-07 Ivan Perez + * Version bump (0.14.6) (#282). + 2023-10-07 Ivan Perez * Version bump (0.14.5) (#278). * Move test for consistency with module tested (#267).