on develop help sign in
Merge pull request #336 from reflex-frp/phadej-haskell-ci

* phadej's haskell-ci setup * Some refactoring for hlint * Bump to v0.6.2.2 * Update version bounds * Add flag to decide if to use the new split-these package

commitc6259c875d85288f7d2045e9cbd5596f6a8634b5 authorOliver Batchelor <saulzar@gmail.com> dateSat 10 Aug 2019, 00:08 (7 years ago) parenteeeae5fbf8a772
34 files changed+319−101
.travis.yml+182 ChangeLog.md+6 cabal.haskell-ci+8 cabal.project+1 default.nix+8−5 reflex.cabal+60−32 release.nix+4−4 src/Data/Functor/Misc.hs−1 src/Reflex/Adjustable/Class.hs−1 src/Reflex/BehaviorWriter/Class.hs−1 src/Reflex/Class.hs+12−13 src/Reflex/Collection.hs+4 src/Reflex/Dynamic/TH.hs+1−1 src/Reflex/DynamicWriter/Class.hs−1 src/Reflex/EventWriter/Base.hs+1−1 src/Reflex/EventWriter/Class.hs−1 src/Reflex/Host/Class.hs−1 src/Reflex/NotReady/Class.hs−1 src/Reflex/Patch/IntMap.hs−8 src/Reflex/Patch/Map.hs−8 src/Reflex/PerformEvent/Base.hs+1−1 src/Reflex/PerformEvent/Class.hs−1 src/Reflex/PostBuild/Class.hs−1 src/Reflex/Profiled.hs+3−3 src/Reflex/Pure.hs−5 src/Reflex/Query/Base.hs−1 src/Reflex/Query/Class.hs−1 src/Reflex/Requester/Class.hs−1 src/Reflex/Spider/Internal.hs+12−3 src/Reflex/TriggerEvent/Class.hs−1 test/EventWriterT.hs+6−4 test/QueryT.hs+4 test/RequesterT.hs+5 test/hlint.hs+1
.travis.ymlnew file+182
@@ -0,0 +1,182 @@
1+# This Travis job script has been generated by a script via
2+#
3+# haskell-ci '--config=cabal.haskell-ci' 'cabal.project'
4+#
5+# For more information, see https://github.com/haskell-CI/haskell-ci
6+#
7+# version: 0.3.20190804.2
8+#
9+language: c
10+dist: xenial
11+sudo: required
12+git:
13+ # whether to recursively clone submodules
14+ submodules: false
15+cache:
16+ directories:
17+ - $HOME/.cabal/packages
18+ - $HOME/.cabal/store
19+before_cache:
20+ - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
21+ # remove files that are regenerated by 'cabal update'
22+ - rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*
23+ - rm -fv $CABALHOME/packages/hackage.haskell.org/*.json
24+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
25+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
26+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
27+ - rm -rfv $CABALHOME/packages/head.hackage
28+
29+matrix:
30+ include:
31+ - compiler: ghcjs-8.4
32+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-3.0"]}}
33+ env: GHCJS_PACKAGE="ghcjs-8.4"
34+ - compiler: ghc-8.6.5
35+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-2.4"]}}
36+ - compiler: ghc-8.4.4
37+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-2.4"]}}
38+ - compiler: ghc-8.2.2
39+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-2.4"]}}
40+ - compiler: ghc-8.0.2
41+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-2.4"]}}
42+ allow_failures:
43+ - compiler: "ghcjs-8.4" # This hits the travis 50min time limit and fails
44+
45+before_install:
46+ - |
47+ if [ "$TRAVIS_OS_NAME" = "linux" ] && [ ! -z "$GHCJS_PACKAGE" ]; then
48+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -;
49+ sudo sh -c "echo deb https://deb.nodesource.com/node_8.x xenial main > /etc/apt/sources.list.d/nodesource.list";
50+ sudo add-apt-repository -y ppa:hvr/ghcjs;
51+ sudo apt-get update;
52+ sudo apt-get install nodejs;
53+ sudo apt-get install "$GHCJS_PACKAGE";
54+ fi
55+ - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
56+ - WITHCOMPILER="-w $HC"
57+ - |
58+ if echo $CC | grep -q ghcjs; then
59+ GHCJS=true
60+ HC=${HC}js
61+ WITHCOMPILER="--ghcjs ${WITHCOMPILER}js"
62+ else
63+ GHCJS=false;
64+ fi
65+ - if $GHCJS ; then sudo apt-get install -y ghc-8.6.5 ; fi
66+ - if $GHCJS ; then PATH="/opt/ghc/8.6.5/bin:$PATH" ; fi
67+ - HCPKG="$HC-pkg"
68+ - unset CC
69+ - CABAL=/opt/ghc/bin/cabal
70+ - CABALHOME=$HOME/.cabal
71+ - export PATH="$CABALHOME/bin:$PATH"
72+ - TOP=$(pwd)
73+ - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
74+ - echo $HCNUMVER
75+ - CABAL="$CABAL -vnormal+nowrap+markoutput"
76+ - set -o pipefail
77+ - |
78+ echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
79+ echo 'BEGIN { state = "output"; }' >> .colorful.awk
80+ echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
81+ echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
82+ echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
83+ echo ' if (state == "cabal") {' >> .colorful.awk
84+ echo ' print blue($0)' >> .colorful.awk
85+ echo ' } else {' >> .colorful.awk
86+ echo ' print $0' >> .colorful.awk
87+ echo ' }' >> .colorful.awk
88+ echo '}' >> .colorful.awk
89+ - cat .colorful.awk
90+ - |
91+ color_cabal_output () {
92+ awk -f $TOP/.colorful.awk
93+ }
94+ - echo text | color_cabal_output
95+install:
96+ - ${CABAL} --version
97+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
98+ - node --version
99+ - echo $GHCJS
100+ - TEST=--enable-tests
101+ - BENCH=--enable-benchmarks
102+ - HEADHACKAGE=false
103+ - rm -f $CABALHOME/config
104+ - |
105+ echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
106+ echo "remote-build-reporting: anonymous" >> $CABALHOME/config
107+ echo "write-ghc-environment-files: always" >> $CABALHOME/config
108+ echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
109+ echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
110+ echo "world-file: $CABALHOME/world" >> $CABALHOME/config
111+ echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
112+ echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
113+ echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
114+ echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
115+ echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
116+ echo "install-dirs user" >> $CABALHOME/config
117+ echo " prefix: $CABALHOME" >> $CABALHOME/config
118+ echo "repository hackage.haskell.org" >> $CABALHOME/config
119+ echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
120+ - cat $CABALHOME/config
121+ - rm -fv cabal.project cabal.project.local cabal.project.freeze
122+ - travis_retry ${CABAL} v2-update -v
123+ - if $GHCJS ; then (cd /tmp && ${CABAL} v2-install -w ghc-8.6.5 happy) ; fi
124+ # Generate cabal.project
125+ - rm -rf cabal.project cabal.project.local cabal.project.freeze
126+ - touch cabal.project
127+ - |
128+ echo "packages: ." >> cabal.project
129+ - cat cabal.project || true
130+ - cat cabal.project.local || true
131+ - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
132+ - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output
133+ - ${CABAL} v2-configure $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output
134+ - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
135+ - rm cabal.project.freeze || true
136+ - rm cabal.project.local || true
137+script:
138+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
139+ # Packaging...
140+ - ${CABAL} v2-sdist all | color_cabal_output
141+ # Unpacking...
142+ - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
143+ - cd ${DISTDIR} || false
144+ - find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;
145+ - find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;
146+ - PKGDIR_reflex="$(find . -maxdepth 1 -type d -regex '.*/reflex-[0-9.]*')"
147+ # Generate cabal.project
148+ - rm -rf cabal.project cabal.project.local cabal.project.freeze
149+ - touch cabal.project
150+ - |
151+ echo "packages: ${PKGDIR_reflex}" >> cabal.project
152+ - |
153+ - cat cabal.project || true
154+ - cat cabal.project.local || true
155+ - rm cabal.project.local || true
156+ # Building...
157+ # this builds all libraries and executables (without tests/benchmarks)
158+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
159+ # Building with tests and benchmarks...
160+ # build & run tests, build benchmarks
161+ - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
162+ # Testing...
163+ - if ! $GHCJS && [ $HCNUMVER -ge 80000 ] && [ $HCNUMVER -lt 80606 ] ; then ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output ; fi
164+ # cabal check...
165+ - (cd ${PKGDIR_reflex} && ${CABAL} -vnormal check)
166+ # haddock...
167+ - if ! $GHCJS && [ $HCNUMVER -ge 80000 ] && [ $HCNUMVER -lt 80606 ] ; then ${CABAL} v2-haddock $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output ; fi
168+ # Building without installed constraints for packages in global-db...
169+ - rm -f cabal.project.local || true
170+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
171+ # Constraint sets
172+ - rm -rf cabal.project.local || true
173+ # Constraint set no-th
174+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='reflex -use-template-haskell' all | color_cabal_output
175+ # Constraint sets
176+ - rm -rf cabal.project.local || true
177+ # Constraint set don't use split these/semialign
178+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='reflex -split-these' all | color_cabal_output
179+
180+# REGENDATA ["--config=cabal.haskell-ci","cabal.project"]
181+# EOF
182+
ChangeLog.md+6
@@ -1,5 +1,11 @@
11# Revision history for reflex
22
3+## 0.6.2.2
4+
5+* Support these >= 1. Add `split-these` flag to control whether to use new these/semialign combination or not.
6+* Update version bounds to fix some CI failures
7+* Add travis CI configuration
8+
39## 0.6.2.1
410
511* Generalize `fan` to `fanG` to take a `DMap` with non-`Identity`
cabal.haskell-cinew file+8
@@ -0,0 +1,8 @@
1+distribution: xenial
2+
3+-- https://github.com/haskell/cabal/issues/6106
4+install-dependencies: False
5+benchmarks: False
6+
7+constraint-set no-th
8+ constraints: reflex -use-template-haskell
cabal.projectnew file+1
@@ -0,0 +1 @@
1+packages: .
default.nix+8−5
@@ -7,11 +7,12 @@
77, transformers-compat, unbounded-delays, prim-uniq
88, data-default, filepath, directory, filemanip, ghcjs-base
99, monoidal-containers, witherable
10+, semialign ? null, splitThese ? (semialign != null)
1011, useTemplateHaskell ? true
1112}:
1213mkDerivation {
1314 pname = "reflex";
14− version = "0.6.2.1";
15+ version = "0.6.2.2";
1516 src = builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) [ ".git" "dist" ])) ./.;
1617 libraryHaskellDepends = [
1718 base bifunctors containers dependent-map dependent-sum
@@ -27,13 +28,15 @@ mkDerivation {
2728 ghcjs-base
2829 ] else []) ++ (if !useTemplateHaskell then [] else [
2930 haskell-src-exts haskell-src-meta
30− ]);
31+ ]) ++ (if splitThese then [
32+ semialign
33+ ] else []);
3134 testHaskellDepends = if ghc.isGhcjs or false then [] else [
3235 hlint filepath directory filemanip
3336 ];
34− configureFlags = if useTemplateHaskell then [] else [
35− "-f-use-template-haskell"
36− ];
37+ configureFlags =
38+ stdenv.lib.optional (!useTemplateHaskell) [ "-f-use-template-haskell" ] ++
39+ stdenv.lib.optional (!splitThese) [ "-f-split-these" ];
3740 homepage = "https://github.com/reflex-frp/reflex";
3841 description = "Higher-order Functional Reactive Programming";
3942 license = stdenv.lib.licenses.bsd3;
reflex.cabal+60−32
@@ -1,5 +1,5 @@
11Name: reflex
2−Version: 0.6.2.1
2+Version: 0.6.2.2
33Synopsis: Higher-order Functional Reactive Programming
44Description: Reflex is a high-performance, deterministic, higher-order Functional Reactive Programming system
55License: BSD3
@@ -17,6 +17,10 @@ extra-source-files:
1717 Quickref.md
1818 ChangeLog.md
1919
20+tested-with:
21+ GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5,
22+ GHCJS ==8.4
23+
2024flag use-reflex-optimizer
2125 description: Use the GHC plugin Reflex.Optimizer on some of the modules in the package. This is still experimental.
2226 default: False
@@ -37,39 +41,48 @@ flag fast-weak
3741 default: False
3842 manual: True
3943
44+flag split-these
45+ description: Use split these/semialign packages
46+ manual: False
47+ default: True
48+
4049library
4150 hs-source-dirs: src
4251 build-depends:
4352 MemoTrie == 0.6.*,
4453 base >= 4.9 && < 4.13,
4554 bifunctors >= 5.2 && < 5.6,
46− comonad,
47− constraints-extras >= 0.2,
48− containers >= 0.5 && < 0.7,
55+ comonad >= 5.0.4 && < 5.1,
56+ constraints-extras >= 0.3 && < 0.4,
57+ containers >= 0.6 && < 0.7,
4958 data-default >= 0.5 && < 0.8,
5059 dependent-map >= 0.3 && < 0.4,
5160 exception-transformers == 0.4.*,
52− profunctors >= 5.0 && < 6.0,
61+ profunctors >= 5.3 && < 5.5,
5362 lens >= 4.7 && < 5,
5463 monad-control >= 1.0.1 && < 1.1,
55− monoidal-containers >= 0.4 && < 0.6,
5664 mtl >= 2.1 && < 2.3,
5765 prim-uniq >= 0.1.0.1 && < 0.2,
58− primitive >= 0.5 && < 0.7,
66+ primitive >= 0.5 && < 0.8,
5967 profunctors,
6068 random == 1.1.*,
6169 ref-tf == 0.4.*,
6270 reflection == 2.1.*,
6371 semigroupoids >= 4.0 && < 6,
64− semigroups >= 0.16 && < 0.19,
6572 stm >= 2.4 && < 2.6,
6673 syb >= 0.5 && < 0.8,
67− these >= 0.4 && < 0.9,
6874 time >= 1.4 && < 1.9,
69− transformers >= 0.2,
70− transformers-compat >= 0.3,
75+ transformers >= 0.5.6.0 && < 0.6,
7176 unbounded-delays >= 0.1.0.0 && < 0.2,
72− witherable >= 0.2 && < 0.4
77+ witherable >= 0.2 && < 0.3
78+
79+ if flag(split-these)
80+ build-depends: these >= 1 && <1.1,
81+ semialign >=1 && <1.1,
82+ monoidal-containers >= 0.5.0.1 && < 0.6
83+ else
84+ build-depends: these >= 0.4 && <0.9,
85+ monoidal-containers == 0.5.0.0
7386
7487 exposed-modules:
7588 Control.Monad.ReaderIO
@@ -146,7 +159,7 @@ library
146159 other-extensions: TemplateHaskell
147160 else
148161 build-depends:
149− dependent-sum == 0.6.*
162+ dependent-sum >= 0.6 && < 0.7
150163
151164 if flag(fast-weak) && impl(ghcjs)
152165 cpp-options: -DGHCJS_FAST_WEAK
@@ -163,14 +176,14 @@ test-suite semantics
163176 base,
164177 bifunctors,
165178 containers,
166− deepseq >= 1.3 && < 1.5,
179+ deepseq,
167180 dependent-map,
168181 dependent-sum,
169182 mtl,
170183 ref-tf,
171184 reflex,
172185 split,
173− transformers >= 0.3
186+ transformers
174187 other-modules:
175188 Reflex.Bench.Focused
176189 Reflex.Plan.Pure
@@ -189,7 +202,7 @@ test-suite CrossImpl
189202 containers,
190203 dependent-map,
191204 dependent-sum,
192− deepseq >= 1.3 && < 1.5,
205+ deepseq,
193206 mtl,
194207 transformers,
195208 ref-tf,
@@ -208,7 +221,7 @@ test-suite hlint
208221 , directory
209222 , filepath
210223 , filemanip
211− , hlint
224+ , hlint < 2.1 || >= 2.2.2
212225 if impl(ghcjs)
213226 buildable: False
214227
@@ -218,7 +231,7 @@ test-suite EventWriterT
218231 hs-source-dirs: test
219232 build-depends: base
220233 , containers
221− , deepseq >= 1.3 && < 1.5
234+ , deepseq
222235 , dependent-map
223236 , dependent-sum
224237 , lens
@@ -227,6 +240,10 @@ test-suite EventWriterT
227240 , transformers
228241 , reflex
229242 , ref-tf
243+
244+ if flag(split-these)
245+ build-depends: these-lens
246+
230247 other-modules:
231248 Reflex.Test
232249 Reflex.TestPlan
@@ -234,13 +251,14 @@ test-suite EventWriterT
234251 Reflex.Plan.Pure
235252 Test.Run
236253
254+
237255test-suite RequesterT
238256 type: exitcode-stdio-1.0
239257 main-is: RequesterT.hs
240258 hs-source-dirs: test
241259 build-depends: base
242260 , containers
243− , deepseq >= 1.3 && < 1.5
261+ , deepseq
244262 , dependent-sum
245263 , dependent-map
246264 , lens
@@ -249,9 +267,14 @@ test-suite RequesterT
249267 , transformers
250268 , reflex
251269 , ref-tf
270+
271+ if flag(split-these)
272+ build-depends: these-lens
273+
252274 other-modules:
253275 Reflex.TestPlan
254276 Reflex.Plan.Pure
277+ Test.Run
255278
256279test-suite QueryT
257280 type: exitcode-stdio-1.0
@@ -261,15 +284,18 @@ test-suite QueryT
261284 , containers
262285 , dependent-map
263286 , dependent-sum
264− , deepseq >= 1.3 && < 1.5
287+ , deepseq
265288 , lens
266289 , monoidal-containers
267290 , mtl
268291 , ref-tf
269292 , reflex
270− , semigroups
271293 , these
272294 , transformers
295+
296+ if flag(split-these)
297+ build-depends: semialign, these-lens
298+
273299 other-modules:
274300 Test.Run
275301 Reflex.TestPlan
@@ -284,14 +310,16 @@ test-suite GC-Semantics
284310 , containers
285311 , dependent-sum
286312 , dependent-map
287− , deepseq >= 1.3 && < 1.5
313+ , deepseq
288314 , mtl
289315 , these
290316 , transformers
291317 , reflex
292318 , ref-tf
293− if impl(ghc < 8)
294− build-depends: semigroups
319+
320+ if flag(split-these)
321+ build-depends: semialign
322+
295323 other-modules:
296324 Reflex.Plan.Pure
297325 Reflex.Plan.Reflex
@@ -304,7 +332,7 @@ test-suite rootCleanup
304332 hs-source-dirs: test
305333 build-depends: base
306334 , containers
307− , deepseq >= 1.3 && < 1.5
335+ , deepseq
308336 , dependent-sum
309337 , mtl
310338 , reflex
@@ -323,8 +351,8 @@ benchmark spider-bench
323351 build-depends:
324352 base,
325353 containers,
326− criterion >= 1.1 && < 1.6,
327− deepseq >= 1.3 && < 1.5,
354+ criterion,
355+ deepseq,
328356 dependent-map,
329357 dependent-sum,
330358 ref-tf,
@@ -333,7 +361,7 @@ benchmark spider-bench
333361 reflex,
334362 split,
335363 stm,
336− transformers >= 0.3
364+ transformers
337365 other-modules:
338366 Reflex.TestPlan
339367 Reflex.Plan.Reflex
@@ -347,9 +375,9 @@ benchmark saulzar-bench
347375 ghc-options: -Wall -O2 -rtsopts -threaded
348376 build-depends:
349377 base,
350− containers >= 0.5 && < 0.7,
351− criterion >= 1.1 && < 1.6,
352− deepseq >= 1.3 && < 1.5,
378+ containers,
379+ criterion,
380+ deepseq,
353381 dependent-map,
354382 dependent-sum,
355383 loch-th,
@@ -361,7 +389,7 @@ benchmark saulzar-bench
361389 split,
362390 stm,
363391 time,
364− transformers >= 0.3
392+ transformers
365393 other-modules:
366394 Reflex.TestPlan
367395 Reflex.Plan.Reflex
release.nix+4−4
@@ -3,7 +3,7 @@
33let
44 inherit (rp.nixpkgs) lib;
55 compilers = ["ghc8_4" "ghc8_0" "ghcjs8_4" "ghcjs8_0"];
6−in lib.genAttrs compilers (ghc: {
7− reflex-useTemplateHaskell = rp.${ghc}.callPackage ./. { useTemplateHaskell = true; };
8− reflex = rp.${ghc}.callPackage ./. { useTemplateHaskell = false; };
9−})
6+in lib.attrValues (lib.genAttrs compilers (ghc: {
7+ reflex-useTemplateHaskell = rp.${ghc}.callPackage ./. { useTemplateHaskell = true; splitThese = false; };
8+ reflex = rp.${ghc}.callPackage ./. { useTemplateHaskell = false; splitThese = false; };
9+}))
src/Data/Functor/Misc.hs−1
@@ -4,7 +4,6 @@
44{-# LANGUAGE FlexibleContexts #-}
55{-# LANGUAGE FlexibleInstances #-}
66{-# LANGUAGE GADTs #-}
7−{-# LANGUAGE KindSignatures #-}
87{-# LANGUAGE LambdaCase #-}
98{-# LANGUAGE MultiParamTypeClasses #-}
109{-# LANGUAGE PatternSynonyms #-}
src/Reflex/Adjustable/Class.hs−1
@@ -3,7 +3,6 @@
33{-# LANGUAGE FlexibleInstances #-}
44{-# LANGUAGE FunctionalDependencies #-}
55{-# LANGUAGE LambdaCase #-}
6−{-# LANGUAGE MultiParamTypeClasses #-}
76{-# LANGUAGE RankNTypes #-}
87{-# LANGUAGE ScopedTypeVariables #-}
98{-# LANGUAGE TypeFamilies #-}
src/Reflex/BehaviorWriter/Class.hs−1
@@ -5,7 +5,6 @@ Description: This module defines the 'MonadBehaviorWriter' class
55{-# LANGUAGE CPP #-}
66{-# LANGUAGE FlexibleInstances #-}
77{-# LANGUAGE FunctionalDependencies #-}
8−{-# LANGUAGE MultiParamTypeClasses #-}
98{-# LANGUAGE UndecidableInstances #-}
109#ifdef USE_REFLEX_OPTIMIZER
1110{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
src/Reflex/Class.hs+12−13
@@ -7,7 +7,6 @@
77{-# LANGUAGE FunctionalDependencies #-}
88{-# LANGUAGE GADTs #-}
99{-# LANGUAGE LambdaCase #-}
10−{-# LANGUAGE MultiParamTypeClasses #-}
1110{-# LANGUAGE NoMonomorphismRestriction #-}
1211{-# LANGUAGE PolyKinds #-}
1312{-# LANGUAGE RankNTypes #-}
@@ -174,6 +173,14 @@ module Reflex.Class
174173 , slowHeadE
175174 ) where
176175
176+#if defined(MIN_VERSION_semialign)
177+import Prelude hiding (zip, zipWith)
178+
179+#if MIN_VERSION_these(0,8,0)
180+import Data.These.Combinators (justThese)
181+#endif
182+#endif
183+
177184import Control.Applicative
178185import Control.Monad.Identity
179186import Control.Monad.Reader
@@ -680,11 +687,7 @@ instance (Num a, Reflex t) => Num (Dynamic t a) where
680687instance (Reflex t, Semigroup a) => Semigroup (Behavior t a) where
681688 a <> b = pull $ liftM2 (<>) (sample a) (sample b)
682689 sconcat = pull . fmap sconcat . mapM sample
683−#if MIN_VERSION_semigroups(0,17,0)
684690 stimes n = fmap $ stimes n
685−#else
686− times1p n = fmap $ times1p n
687−#endif
688691
689692-- | Alias for 'mapMaybe'
690693fmapMaybe :: Filterable f => (a -> Maybe b) -> f a -> f b
@@ -882,11 +885,7 @@ traceEventWith f = push $ \x -> trace (f x) $ return $ Just x
882885instance (Semigroup a, Reflex t) => Semigroup (Event t a) where
883886 (<>) = alignWith (mergeThese (<>))
884887 sconcat = fmap sconcat . mergeList . toList
885−#if MIN_VERSION_semigroups(0,17,0)
886888 stimes n = fmap $ stimes n
887−#else
888− times1p n = fmap $ times1p n
889−#endif
890889
891890instance (Semigroup a, Reflex t) => Monoid (Event t a) where
892891 mempty = never
@@ -1074,6 +1073,10 @@ instance Reflex t => Align (Event t) where
10741073instance Reflex t => Semialign (Event t) where
10751074#endif
10761075 align = alignEventWithMaybe Just
1076+
1077+#if defined(MIN_VERSION_semialign)
1078+ zip x y = mapMaybe justThese $ align x y
1079+#endif
10771080
10781081
10791082-- | Create a new 'Event' that only occurs if the supplied 'Event' occurs and
@@ -1115,11 +1118,7 @@ zipDynWith f da db =
11151118
11161119instance (Reflex t, Semigroup a) => Semigroup (Dynamic t a) where
11171120 (<>) = zipDynWith (<>)
1118−#if MIN_VERSION_semigroups(0,17,0)
11191121 stimes n = fmap $ stimes n
1120−#else
1121− times1p n = fmap $ times1p n
1122−#endif
11231122
11241123instance (Reflex t, Monoid a) => Monoid (Dynamic t a) where
11251124 mconcat = distributeListOverDynWith mconcat
src/Reflex/Collection.hs+4
@@ -27,6 +27,10 @@ module Reflex.Collection
2727 , simpleList
2828 ) where
2929
30+#if defined(MIN_VERSION_semialign)
31+import Prelude hiding (zip, zipWith)
32+#endif
33+
3034import Control.Monad.Identity
3135import Data.Align
3236import Data.Functor.Misc
src/Reflex/Dynamic/TH.hs+1−1
@@ -81,7 +81,7 @@ mkDynPure = QuasiQuoter
8181 }
8282
8383mkDynExp :: String -> Q Exp
84−mkDynExp s = case Hs.parseExpWithMode (Hs.defaultParseMode { Hs.extensions = [ Hs.EnableExtension Hs.TemplateHaskell ] }) s of
84+mkDynExp s = case Hs.parseExpWithMode Hs.defaultParseMode { Hs.extensions = [ Hs.EnableExtension Hs.TemplateHaskell ] } s of
8585 Hs.ParseFailed (Hs.SrcLoc _ l c) err -> fail $ "mkDyn:" <> show l <> ":" <> show c <> ": " <> err
8686 Hs.ParseOk e -> qDynPure $ return $ everywhere (id `extT` reinstateUnqDyn) $ Hs.toExp $ everywhere (id `extT` antiE) e
8787 where TH.Name (TH.OccName occName) (TH.NameG _ _ (TH.ModName modName)) = 'unqMarker
src/Reflex/DynamicWriter/Class.hs−1
@@ -3,7 +3,6 @@
33{-# LANGUAGE CPP #-}
44{-# LANGUAGE FlexibleInstances #-}
55{-# LANGUAGE FunctionalDependencies #-}
6−{-# LANGUAGE MultiParamTypeClasses #-}
76{-# LANGUAGE UndecidableInstances #-}
87#ifdef USE_REFLEX_OPTIMIZER
98{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
src/Reflex/EventWriter/Base.hs+1−1
@@ -52,7 +52,7 @@ import qualified Data.Map as Map
5252import Data.Semigroup
5353import Data.Some (Some)
5454import Data.Tuple
55−import Data.Type.Equality hiding (apply)
55+import Data.Type.Equality
5656
5757import Unsafe.Coerce
5858
src/Reflex/EventWriter/Class.hs−1
@@ -2,7 +2,6 @@
22{-# LANGUAGE CPP #-}
33{-# LANGUAGE FlexibleInstances #-}
44{-# LANGUAGE FunctionalDependencies #-}
5−{-# LANGUAGE MultiParamTypeClasses #-}
65{-# LANGUAGE UndecidableInstances #-}
76#ifdef USE_REFLEX_OPTIMIZER
87{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
src/Reflex/Host/Class.hs−1
@@ -4,7 +4,6 @@
44{-# LANGUAGE FlexibleInstances #-}
55{-# LANGUAGE FunctionalDependencies #-}
66{-# LANGUAGE GADTs #-}
7−{-# LANGUAGE MultiParamTypeClasses #-}
87{-# LANGUAGE RankNTypes #-}
98{-# LANGUAGE RoleAnnotations #-}
109{-# LANGUAGE ScopedTypeVariables #-}
src/Reflex/NotReady/Class.hs−1
@@ -3,7 +3,6 @@
33{-# LANGUAGE FlexibleContexts #-}
44{-# LANGUAGE FlexibleInstances #-}
55{-# LANGUAGE FunctionalDependencies #-}
6−{-# LANGUAGE MultiParamTypeClasses #-}
76{-# LANGUAGE TypeFamilies #-}
87{-# LANGUAGE UndecidableInstances #-}
98#ifdef USE_REFLEX_OPTIMIZER
src/Reflex/Patch/IntMap.hs−8
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE DeriveFoldable #-}
32{-# LANGUAGE DeriveFunctor #-}
43{-# LANGUAGE DeriveTraversable #-}
@@ -33,14 +32,7 @@ instance Patch (PatchIntMap a) where
3332instance Semigroup (PatchIntMap v) where
3433 PatchIntMap a <> PatchIntMap b = PatchIntMap $ a `mappend` b --TODO: Add a semigroup instance for Map
3534 -- PatchMap is idempotent, so stimes n is id for every n
36−#if MIN_VERSION_semigroups(0,17,0)
3735 stimes = stimesIdempotentMonoid
38−#else
39− times1p n x = case compare n 0 of
40− LT -> error "stimesIdempotentMonoid: negative multiplier"
41− EQ -> mempty
42− GT -> x
43−#endif
4436
4537-- | Map a function @Int -> a -> b@ over all @a@s in the given @'PatchIntMap' a@
4638-- (that is, all inserts/updates), producing a @PatchIntMap b@.
src/Reflex/Patch/Map.hs−8
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE LambdaCase #-}
32{-# LANGUAGE TypeFamilies #-}
43-- | 'Patch'es on 'Map' that consist only of insertions (including overwrites)
@@ -35,14 +34,7 @@ instance Ord k => Patch (PatchMap k v) where
3534instance Ord k => Semigroup (PatchMap k v) where
3635 PatchMap a <> PatchMap b = PatchMap $ a `mappend` b --TODO: Add a semigroup instance for Map
3736 -- PatchMap is idempotent, so stimes n is id for every n
38−#if MIN_VERSION_semigroups(0,17,0)
3937 stimes = stimesIdempotentMonoid
40−#else
41− times1p n x = case compare n 0 of
42− LT -> error "stimesIdempotentMonoid: negative multiplier"
43− EQ -> mempty
44− GT -> x
45−#endif
4638
4739-- | The empty 'PatchMap' contains no insertions or deletions
4840instance Ord k => Monoid (PatchMap k v) where
src/Reflex/PerformEvent/Base.hs+1−1
@@ -141,7 +141,7 @@ hostPerformEventT a = do
141141 case mToPerform of
142142 Nothing -> return [result']
143143 Just toPerform -> do
144− responses <- runHostFrame $ traverseRequesterData (\v -> Identity <$> v) toPerform
144+ responses <- runHostFrame $ traverseRequesterData (Identity <$>) toPerform
145145 mrt <- readRef responseTrigger
146146 let followupEventTriggers = case mrt of
147147 Just rt -> [rt :=> Identity responses]
src/Reflex/PerformEvent/Class.hs−1
@@ -5,7 +5,6 @@
55{-# LANGUAGE FlexibleContexts #-}
66{-# LANGUAGE FlexibleInstances #-}
77{-# LANGUAGE FunctionalDependencies #-}
8−{-# LANGUAGE MultiParamTypeClasses #-}
98{-# LANGUAGE RankNTypes #-}
109{-# LANGUAGE ScopedTypeVariables #-}
1110{-# LANGUAGE TypeFamilies #-}
src/Reflex/PostBuild/Class.hs−1
@@ -4,7 +4,6 @@
44{-# LANGUAGE DataKinds #-}
55{-# LANGUAGE FlexibleInstances #-}
66{-# LANGUAGE FunctionalDependencies #-}
7−{-# LANGUAGE MultiParamTypeClasses #-}
87{-# LANGUAGE ScopedTypeVariables #-}
98{-# LANGUAGE TypeFamilies #-}
109{-# LANGUAGE TypeOperators #-}
src/Reflex/Profiled.hs+3−3
@@ -80,9 +80,9 @@ getCostCentreStack = go []
8080 go (cc : l) parent
8181
8282toCostCentreTree :: Ptr CostCentreStack -> Int -> IO CostCentreTree
83−toCostCentreTree ccs n = do
84− ccList <- getCostCentreStack ccs
85− return $ foldr (\cc child -> CostCentreTree 0 n $ Map.singleton cc child) (CostCentreTree n n mempty) ccList
83+toCostCentreTree ccs n =
84+ foldr (\cc child -> CostCentreTree 0 n $ Map.singleton cc child) (CostCentreTree n n mempty)
85+ <$> getCostCentreStack ccs
8686
8787getCostCentreTree :: IO CostCentreTree
8888getCostCentreTree = do
src/Reflex/Pure.hs−5
@@ -31,14 +31,9 @@ module Reflex.Pure
3131 , Incremental (..)
3232 ) where
3333
34−#if !MIN_VERSION_base(4,8,0)
35−import Control.Applicative
36−#endif
37−
3834import Control.Monad
3935import Data.Dependent.Map (DMap, GCompare)
4036import qualified Data.Dependent.Map as DMap
41−import Data.Functor.Identity
4237import Data.IntMap (IntMap)
4338import qualified Data.IntMap as IntMap
4439import Data.Maybe
src/Reflex/Query/Base.hs−1
@@ -1,7 +1,6 @@
11{-# LANGUAGE FlexibleInstances #-}
22{-# LANGUAGE GeneralizedNewtypeDeriving #-}
33{-# LANGUAGE InstanceSigs #-}
4−{-# LANGUAGE KindSignatures #-}
54{-# LANGUAGE LambdaCase #-}
65{-# LANGUAGE MultiParamTypeClasses #-}
76{-# LANGUAGE RankNTypes #-}
src/Reflex/Query/Class.hs−1
@@ -3,7 +3,6 @@
33{-# LANGUAGE FlexibleInstances #-}
44{-# LANGUAGE FunctionalDependencies #-}
55{-# LANGUAGE GeneralizedNewtypeDeriving #-}
6−{-# LANGUAGE MultiParamTypeClasses #-}
76{-# LANGUAGE TypeFamilies #-}
87{-# LANGUAGE UndecidableInstances #-}
98-- |
src/Reflex/Requester/Class.hs−1
@@ -6,7 +6,6 @@
66{-# LANGUAGE CPP #-}
77{-# LANGUAGE FlexibleInstances #-}
88{-# LANGUAGE FunctionalDependencies #-}
9−{-# LANGUAGE MultiParamTypeClasses #-}
109{-# LANGUAGE RecursiveDo #-}
1110{-# LANGUAGE TypeFamilies #-}
1211{-# LANGUAGE UndecidableInstances #-}
src/Reflex/Spider/Internal.hs+12−3
@@ -9,7 +9,6 @@
99{-# LANGUAGE GADTs #-}
1010{-# LANGUAGE GeneralizedNewtypeDeriving #-}
1111{-# LANGUAGE LambdaCase #-}
12−{-# LANGUAGE MultiParamTypeClasses #-}
1312{-# LANGUAGE MultiWayIf #-}
1413{-# LANGUAGE RankNTypes #-}
1514{-# LANGUAGE RoleAnnotations #-}
@@ -73,6 +72,12 @@ import System.IO.Unsafe
7372import System.Mem.Weak
7473import Unsafe.Coerce
7574
75+#if defined(MIN_VERSION_semialign)
76+#if MIN_VERSION_these(0,8,0)
77+import Data.These.Combinators (justThese)
78+#endif
79+#endif
80+
7681#ifdef DEBUG_CYCLES
7782import Control.Monad.State hiding (forM, forM_, mapM, mapM_, sequence)
7883import Data.List.NonEmpty (NonEmpty (..), nonEmpty)
@@ -1158,6 +1163,10 @@ instance HasSpiderTimeline x => Semialign (Event x) where
11581163 align ea eb = mapMaybe dmapToThese $ mergeG coerce $ dynamicConst $
11591164 DMap.fromDistinctAscList [LeftTag :=> ea, RightTag :=> eb]
11601165
1166+#if defined(MIN_VERSION_semialign)
1167+ zip x y = mapMaybe justThese $ align x y
1168+#endif
1169+
11611170data DynType x p = UnsafeDyn !(BehaviorM x (PatchTarget p), Event x p)
11621171 | BuildDyn !(EventM x (PatchTarget p), Event x p)
11631172 | HoldDyn !(Hold x p)
@@ -1761,7 +1770,7 @@ mergeCheap nt = mergeGCheap' getInitialSubscribers updateMe destroy
17611770 let s = subscriber $ return k
17621771 (subscription@(EventSubscription _ parentSubd), parentOcc) <- subscribeAndRead (nt e) s
17631772 height <- liftIO $ getEventSubscribedHeight parentSubd
1764− return (fmap (\x -> k :=> x) parentOcc, height, k :=> MergeSubscribedParent subscription)
1773+ return (fmap (k :=>) parentOcc, height, k :=> MergeSubscribedParent subscription)
17651774 return ( DMap.fromDistinctAscList $ mapMaybe (\(x, _, _) -> x) subscribers
17661775 , fmap (\(_, h, _) -> h) subscribers --TODO: Assert that there's no invalidHeight in here
17671776 , DMap.fromDistinctAscList $ map (\(_, _, x) -> x) subscribers
@@ -1809,7 +1818,7 @@ mergeCheapWithMove nt = mergeGCheap' getInitialSubscribers updateMe destroy
18091818 let s = subscriber $ liftIO $ readIORef keyRef
18101819 (subscription@(EventSubscription _ parentSubd), parentOcc) <- subscribeAndRead (nt e) s
18111820 height <- liftIO $ getEventSubscribedHeight parentSubd
1812− return (fmap (\x -> k :=> x) parentOcc, height, k :=> MergeSubscribedParentWithMove subscription keyRef)
1821+ return (fmap (k :=>) parentOcc, height, k :=> MergeSubscribedParentWithMove subscription keyRef)
18131822 return ( DMap.fromDistinctAscList $ mapMaybe (\(x, _, _) -> x) subscribers
18141823 , fmap (\(_, h, _) -> h) subscribers --TODO: Assert that there's no invalidHeight in here
18151824 , DMap.fromDistinctAscList $ map (\(_, _, x) -> x) subscribers
src/Reflex/TriggerEvent/Class.hs−1
@@ -2,7 +2,6 @@
22-- new 'Event's that can be triggered from 'IO'.
33{-# LANGUAGE FlexibleInstances #-}
44{-# LANGUAGE FunctionalDependencies #-}
5−{-# LANGUAGE MultiParamTypeClasses #-}
65{-# LANGUAGE UndecidableInstances #-}
76module Reflex.TriggerEvent.Class
87 ( TriggerEvent (..)
test/EventWriterT.hs+6−4
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE BangPatterns #-}
23{-# LANGUAGE FlexibleContexts #-}
34{-# LANGUAGE GADTs #-}
@@ -13,6 +14,10 @@ import Data.Functor.Misc
1314import qualified Data.Map as M
1415import Data.These
1516
17+#if defined(MIN_VERSION_these_lens) || (MIN_VERSION_these(0,8,0) && !MIN_VERSION_these(0,9,0))
18+import Data.These.Lens
19+#endif
20+
1621import Reflex
1722import Reflex.EventWriter.Base
1823import Test.Run
@@ -48,16 +53,13 @@ unwrapApp x appIn = do
4853 return e
4954
5055testOrdering :: (Reflex t, Monad m) => Event t () -> EventWriterT t [Int] m ()
51−testOrdering pulse = do
52− forM_ [10,9..1] $ \i -> tellEvent ([i] <$ pulse)
53− return ()
56+testOrdering pulse = forM_ [10,9..1] $ \i -> tellEvent ([i] <$ pulse)
5457
5558testSimultaneous :: (Reflex t, Adjustable t m, MonadHold t m) => Event t (These () ()) -> EventWriterT t [Int] m ()
5659testSimultaneous pulse = do
5760 let e0 = fmapMaybe (^? here) pulse
5861 e1 = fmapMaybe (^? there) pulse
5962 forM_ [1,3..9] $ \i -> runWithReplace (tellEvent ([i] <$ e0)) $ ffor e1 $ \_ -> tellEvent ([i+1] <$ e0)
60− return ()
6163
6264-- | Test that a widget telling and event which fires at the same time it has been replaced
6365-- doesn't count along with the new widget.
test/QueryT.hs+4
@@ -19,6 +19,10 @@ import Data.Map.Monoidal (MonoidalMap)
1919import Data.Semigroup
2020import Data.These
2121
22+#if defined(MIN_VERSION_these_lens) || (MIN_VERSION_these(0,8,0) && !MIN_VERSION_these(0,9,0))
23+import Data.These.Lens
24+#endif
25+
2226import Reflex
2327import Reflex.Patch.MapWithMove
2428import Test.Run
test/RequesterT.hs+5
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE BangPatterns #-}
23{-# LANGUAGE FlexibleContexts #-}
34{-# LANGUAGE GADTs #-}
@@ -15,6 +16,10 @@ import Data.Functor.Misc
1516import qualified Data.Map as M
1617import Data.These
1718
19+#if defined(MIN_VERSION_these_lens) || (MIN_VERSION_these(0,8,0) && !MIN_VERSION_these(0,9,0))
20+import Data.These.Lens
21+#endif
22+
1823import Reflex
1924import Reflex.Requester.Base
2025import Reflex.Requester.Class
test/hlint.hs+1
@@ -22,6 +22,7 @@ main = do
2222 , "--ignore=Use unless"
2323 , "--ignore=Reduce duplication"
2424 , "--cpp-define=USE_TEMPLATE_HASKELL"
25+ , "--ignore=Use tuple-section"
2526 ]
2627 recurseInto = and <$> sequence
2728 [ fileType ==? Directory