From 92438e7d333221d0d10b937cd1c4bb15beee1ae7 Mon Sep 17 00:00:00 2001 From: Ali Abrar Date: Fri, 31 Jan 2020 10:24:05 -0500 Subject: [PATCH 01/21] Update README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d23f837..b4b27ba 100644 --- a/README.md +++ b/README.md @@ -20,17 +20,18 @@ This package includes a [reflex-vty](https://github.com/reflex-frp/reflex-vty)-b ```bash $ reflex-ghci -h -Welcome to reflex-ghci! +Welcome to reflex-ghci 0.1.4.0 -Usage: [-c|--command COMMAND] [-e|--expression EXPR] +Usage: reflex-ghci [-c|--command COMMAND] [-e|--expression EXPR] Run a Haskell REPL that automatically reloads when source files change. Available options: -c,--command COMMAND The ghci/cabal repl command to - run (default: "cabal repl") + run (default: "cabal repl --repl-options=-Wall") -e,--expression EXPR The optional expression to evaluate once modules have - successfully loaded (default: no expression) + successfully loaded -h,--help Show this help text + ``` Acknowledgements From 319bb077be90a38063ec24295cc5e0e215e26258 Mon Sep 17 00:00:00 2001 From: Carlo Nucera Date: Thu, 30 Apr 2020 12:21:35 -0400 Subject: [PATCH 02/21] Use Reflex.Headless.Host for the test suite --- reflex-ghci.cabal | 1 - tests/HeadlessHost.hs | 83 ------------------------------------------- tests/test.hs | 2 +- 3 files changed, 1 insertion(+), 85 deletions(-) delete mode 100644 tests/HeadlessHost.hs diff --git a/reflex-ghci.cabal b/reflex-ghci.cabal index 392af1f..c5dfc05 100644 --- a/reflex-ghci.cabal +++ b/reflex-ghci.cabal @@ -79,7 +79,6 @@ test-suite test , reflex-vty , temporary >= 1.3 && < 1.4 , text - other-modules: HeadlessHost ghc-options: -threaded -rtsopts default-language: Haskell2010 diff --git a/tests/HeadlessHost.hs b/tests/HeadlessHost.hs deleted file mode 100644 index 687ec3f..0000000 --- a/tests/HeadlessHost.hs +++ /dev/null @@ -1,83 +0,0 @@ -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ConstraintKinds #-} -module HeadlessHost where - -import Data.Maybe -import Reflex -import Control.Monad.Fix -import Control.Monad.Primitive -import Reflex.Host.Class -import Control.Monad.IO.Class -import Control.Monad.Ref -import Data.IORef -import Data.Dependent.Sum -import Control.Concurrent.Chan (newChan, readChan) -import Control.Monad (forM, forM_) -import Control.Monad.Identity (Identity(..)) - -type HeadlessResult t = Event t () - -type MonadHeadlessApp t m = - ( Reflex t - , MonadHold t m - , MonadFix m - , PrimMonad (HostFrame t) - , ReflexHost t - , MonadIO (HostFrame t) - , Ref m ~ IORef - , Ref (HostFrame t) ~ IORef - , MonadRef (HostFrame t) - , NotReady t m - , TriggerEvent t m - , PostBuild t m - , PerformEvent t m - , MonadIO m - , MonadIO (Performable m) - , Adjustable t m - ) - -runHeadlessApp - :: (forall t m. MonadHeadlessApp t m => m (HeadlessResult t)) - -> IO () -runHeadlessApp guest = - (runSpiderHost :: SpiderHost Global a -> IO a) $ do - (postBuild, postBuildTriggerRef) <- newEventWithTriggerRef - events <- liftIO newChan - (vtyResult, fc@(FireCommand fire)) <- do - hostPerformEventT $ - flip runPostBuildT postBuild $ - flip runTriggerEventT events $ - guest - mPostBuildTrigger <- readRef postBuildTriggerRef - forM_ mPostBuildTrigger $ \postBuildTrigger -> - fire [postBuildTrigger :=> Identity ()] $ return () - shutdown <- subscribeEvent vtyResult - fix $ \loop -> do - ers <- liftIO $ readChan events - stop <- fireEventTriggerRefs fc ers $ readEvent shutdown >>= \case - Nothing -> return False - Just _ -> return True - if or stop - then return () - else loop - where - -- TODO Some part of this is probably general enough to belong in reflex - -- | Use the given 'FireCommand' to fire events that have subscribers - -- and call the callback for the 'TriggerInvocation' of each. - fireEventTriggerRefs - :: (Monad (ReadPhase m), MonadIO m) - => FireCommand t m - -> [DSum (EventTriggerRef t) TriggerInvocation] - -> ReadPhase m a - -> m [a] - fireEventTriggerRefs (FireCommand fire) ers rcb = do - mes <- liftIO $ - forM ers $ \(EventTriggerRef er :=> TriggerInvocation a _) -> do - me <- readIORef er - return $ fmap (\e -> e :=> Identity a) me - a <- fire (catMaybes mes) rcb - liftIO $ forM_ ers $ \(_ :=> TriggerInvocation _ cb) -> cb - return a diff --git a/tests/test.hs b/tests/test.hs index 2a593c5..e8e127a 100644 --- a/tests/test.hs +++ b/tests/test.hs @@ -3,8 +3,8 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} -import HeadlessHost import Reflex +import Reflex.Host.Headless import Reflex.Process.GHCi import Reflex.Vty import Reflex.Vty.GHCi From faeeed381906a69ee635fbca0bd7739fc773a9a0 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Tue, 2 Jun 2020 13:43:41 -0400 Subject: [PATCH 03/21] Fix lint --- src/Reflex/Process/GHCi.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Reflex/Process/GHCi.hs b/src/Reflex/Process/GHCi.hs index 4fdc104..68bd0bf 100644 --- a/src/Reflex/Process/GHCi.hs +++ b/src/Reflex/Process/GHCi.hs @@ -91,7 +91,7 @@ ghci cmd mexpr reloadReq = do -- Only interrupt when there's a file change and we're ready and not in an idle state let interruptible s = s `elem` [Status_Loading, Status_Executing] - requestInterrupt = gate (interruptible <$> current status) $ (() <$ reloadReq) + requestInterrupt = gate (interruptible <$> current status) (() <$ reloadReq) -- Define some Regex patterns to use to determine GHCi's state based on output let okModulesLoaded = "Ok.*module.*loaded." :: ByteString @@ -114,7 +114,7 @@ ghci cmd mexpr reloadReq = do else Nothing , const Status_Loading <$ reload , ffor (updated output) $ \out -> case reverse (C8.lines out) of - (lastLine:expectedMessage:_) + lastLine:expectedMessage:_ | lastLine == prompt && expectedMessage Regex.=~ okModulesLoaded -> const Status_LoadSucceeded | lastLine == prompt && expectedMessage Regex.=~ failedNoModulesLoaded -> const Status_LoadFailed | lastLine == prompt -> \case @@ -127,7 +127,7 @@ ghci cmd mexpr reloadReq = do Just _ -> Status_Executing s -> s - (lastLine:_) + lastLine:_ | lastLine Regex.=~ ghciVersionMessage -> const Status_Loading _ -> id ] From 5cff304624f7ab9ddbda973c1e14ff41095cf161 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Tue, 2 Jun 2020 13:45:04 -0400 Subject: [PATCH 04/21] Update reflex-process to 0.3 --- reflex-ghci.cabal | 10 +++++----- src/Reflex/Process/GHCi.hs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/reflex-ghci.cabal b/reflex-ghci.cabal index 392af1f..60c4628 100644 --- a/reflex-ghci.cabal +++ b/reflex-ghci.cabal @@ -25,20 +25,20 @@ library Reflex.Process.GHCi Reflex.Vty.GHCi build-depends: - base >= 4.12 && < 4.13 + base >= 4.12 && < 4.14 , bytestring >= 0.10 && < 0.11 , directory >= 1.3 && < 1.4 , filepath >= 1.4 && < 1.5 , fsnotify >= 0.3 && < 0.4 , process >= 1.6 && < 1.7 - , reflex >= 0.6.3 && < 0.7 + , reflex >= 0.6.3 && < 0.8 , reflex-fsnotify >= 0.2 && < 0.3 - , reflex-process >= 0.2.1 && < 0.3 - , regex-tdfa >= 1.2.3 && < 1.3 + , reflex-process >= 0.3 && < 0.4 + , regex-tdfa >= 1.2.3 && < 1.4 , reflex-vty >= 0.1.3 && < 0.2 , text >= 1.2 && < 1.3 , unix >= 2.7 && < 2.8 - , vty >= 5.25 && < 5.26 + , vty >=5.21 && <5.29 hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall diff --git a/src/Reflex/Process/GHCi.hs b/src/Reflex/Process/GHCi.hs index 68bd0bf..01f76c8 100644 --- a/src/Reflex/Process/GHCi.hs +++ b/src/Reflex/Process/GHCi.hs @@ -20,7 +20,7 @@ module Reflex.Process.GHCi import Reflex import Reflex.FSNotify (watchDirectoryTree) -import Reflex.Process (ProcessConfig(..), Process(..), createProcess) +import Reflex.Process (ProcessConfig(..), Process(..), SendPipe(..), createProcess) import Control.Monad ((<=<)) import Control.Monad.Fix (MonadFix) @@ -55,7 +55,7 @@ ghci ghci cmd mexpr reloadReq = do -- Run the process and feed it some input: rec proc <- createProcess cmd $ ProcessConfig - { _processConfig_stdin = leftmost + { _processConfig_stdin = SendPipe_Message . (<> "\n") <$> leftmost [ reload -- Execute some expression if GHCi is ready to receive it , fforMaybe (updated status) $ \case From 9e7fbbfe09e80433a4ee78b814287678fdf0c80c Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Tue, 2 Jun 2020 15:38:03 -0400 Subject: [PATCH 05/21] Bump bounds for reflex --- reflex-ghci.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reflex-ghci.cabal b/reflex-ghci.cabal index c5dfc05..3bb7d9a 100644 --- a/reflex-ghci.cabal +++ b/reflex-ghci.cabal @@ -31,7 +31,7 @@ library , filepath >= 1.4 && < 1.5 , fsnotify >= 0.3 && < 0.4 , process >= 1.6 && < 1.7 - , reflex >= 0.6.3 && < 0.7 + , reflex >= 0.7.1.0 && < 0.8 , reflex-fsnotify >= 0.2 && < 0.3 , reflex-process >= 0.2.1 && < 0.3 , regex-tdfa >= 1.2.3 && < 1.3 From 867afec7f0fea16fe242bb15c20392b5175eba12 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Fri, 5 Jun 2020 18:29:31 -0400 Subject: [PATCH 06/21] Make tests work on newer GHC --- reflex-ghci.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reflex-ghci.cabal b/reflex-ghci.cabal index 60c4628..9dab33b 100644 --- a/reflex-ghci.cabal +++ b/reflex-ghci.cabal @@ -70,7 +70,7 @@ test-suite test , dependent-sum >= 0.6 && < 0.7 , directory , mtl >= 2.2 && < 2.3 - , primitive >= 0.6.4 && < 0.7 + , primitive >= 0.6.4 && < 0.8 , process , ref-tf >= 0.4 && < 0.5 , reflex From 86458b77025a57e82d8389d8dbfdafe108772e94 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Fri, 5 Jun 2020 18:29:56 -0400 Subject: [PATCH 07/21] Fix Nix CI --- release.nix | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/release.nix b/release.nix index 2d3a600..ab3b5e6 100644 --- a/release.nix +++ b/release.nix @@ -1,5 +1,41 @@ -{ p ? import ./reflex-platform {} +{ reflex-platform-fun ? import ./reflex-platform }: -let - inherit (p.nixpkgs) lib; -in p.ghc.callPackage ./. {} +(reflex-platform-fun { + haskellOverlaysPost = [ + (self: super: { + reflex = self.callHackageDirect { + pkg = "reflex"; + ver = "0.7.1.0"; + sha256 = "0a933xz7yl931m90bbwi9akfz77q6px36grlx6wba55mn1klpn27"; + } {}; + + reflex-fsnotify = self.callHackageDirect { + pkg = "reflex-fsnotify"; + ver = "0.2.1.1"; + sha256 = "1snbvf8z942fpb0r5spaxcdc036v6b1akgdscpfghz81bdvcxy8i"; + } {}; + + reflex-process = self.callHackageDirect { + pkg = "reflex-process"; + ver = "0.3.0.0"; + sha256 = "0xx8gzs7c60zh8rj794hyisljp0gwb26m34ns8z9xgp1k8jgkdgj"; + } {}; + + reflex-vty = self.callHackageDirect { + pkg = "reflex-vty"; + ver = "0.1.4.0"; + sha256 = "0djs7y4mmkb2q5hvp1fr1gn81k08hzab8v3c6qvh7nyn1fdh8zvh"; + } {}; + }) + ]; +}).ghc.callPackage + (builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) [ + "release.nix" + ".git" + "dist" + "dist-newstyle" + "cabal.project" + ".travis.yml" + ])) ./. + ) + {} From 50093cfd7982ea9080a87a9bc0709ee604b09e5e Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Fri, 5 Jun 2020 19:25:46 -0400 Subject: [PATCH 08/21] Test on GHC 8.8.3 --- .travis.yml | 2 ++ reflex-ghci.cabal | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0c46109..29e3dec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,8 @@ before_cache: - rm -rfv $CABALHOME/packages/head.hackage matrix: include: + - compiler: ghc-8.8.3 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.3","cabal-install-3.2"]}} - compiler: ghc-8.6.5 addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-2.4"]}} before_install: diff --git a/reflex-ghci.cabal b/reflex-ghci.cabal index 9dab33b..c2056fb 100644 --- a/reflex-ghci.cabal +++ b/reflex-ghci.cabal @@ -18,7 +18,7 @@ build-type: Simple extra-source-files: ChangeLog.md README.md screenshot.png -tested-with: GHC ==8.6.5 +tested-with: GHC ==8.6.5 || ==8.8.3 library exposed-modules: From e27354c42fe8c4b0eb9449df69a1293f7cf62e88 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Fri, 5 Jun 2020 21:34:00 -0400 Subject: [PATCH 09/21] Regenerate .travis.yml --- .travis.yml | 74 ++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/.travis.yml b/.travis.yml index 29e3dec..55eaccc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,19 @@ # This Travis job script has been generated by a script via # -# haskell-ci 'reflex-ghci.cabal' '--output' '.travis.yml' +# haskell-ci 'reflex-ghci.cabal' +# +# To regenerate the script (for example after adjusting tested-with) run +# +# haskell-ci regenerate # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.3.20190814 +# version: 0.10.2 # +version: ~> 1.0 language: c +os: linux dist: xenial -sudo: required git: # whether to recursively clone submodules submodules: false @@ -16,6 +21,7 @@ cache: directories: - $HOME/.cabal/packages - $HOME/.cabal/store + - $HOME/.hlint before_cache: - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log # remove files that are regenerated by 'cabal update' @@ -25,15 +31,18 @@ before_cache: - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx - rm -rfv $CABALHOME/packages/head.hackage -matrix: +jobs: include: - compiler: ghc-8.8.3 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.3","cabal-install-3.2"]}} + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.3","cabal-install-3.2"]}} + os: linux - compiler: ghc-8.6.5 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-2.4"]}} + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.2"]}} + os: linux before_install: - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//') - WITHCOMPILER="-w $HC" + - HADDOCK=$(echo "/opt/$CC/bin/haddock" | sed 's/-/\//') - HCPKG="$HC-pkg" - unset CC - CABAL=/opt/ghc/bin/cabal @@ -42,29 +51,8 @@ before_install: - TOP=$(pwd) - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')" - echo $HCNUMVER - - CABAL="$CABAL -vnormal+nowrap+markoutput" + - CABAL="$CABAL -vnormal+nowrap" - set -o pipefail - - | - echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk - echo 'BEGIN { state = "output"; }' >> .colorful.awk - echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk - echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk - echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk - echo ' if (state == "cabal") {' >> .colorful.awk - echo ' print blue($0)' >> .colorful.awk - echo ' } else {' >> .colorful.awk - echo ' print $0' >> .colorful.awk - echo ' }' >> .colorful.awk - echo '}' >> .colorful.awk - - cat .colorful.awk - - | - color_cabal_output () { - awk -f $TOP/.colorful.awk - } - - echo text | color_cabal_output -install: - - ${CABAL} --version - - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" - TEST=--enable-tests - BENCH=--enable-benchmarks - HEADHACKAGE=false @@ -85,6 +73,12 @@ install: echo " prefix: $CABALHOME" >> $CABALHOME/config echo "repository hackage.haskell.org" >> $CABALHOME/config echo " url: http://hackage.haskell.org/" >> $CABALHOME/config +install: + - ${CABAL} --version + - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" + - | + echo "program-default-options" >> $CABALHOME/config + echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config - cat $CABALHOME/config - rm -fv cabal.project cabal.project.local cabal.project.freeze - travis_retry ${CABAL} v2-update -v @@ -93,20 +87,22 @@ install: - touch cabal.project - | echo "packages: ." >> cabal.project + - echo 'package reflex-ghci' >> cabal.project + - "echo ' ghc-options: -Werror=missing-methods' >> cabal.project" - | - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(reflex-ghci)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" - cat cabal.project || true - cat cabal.project.local || true - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi - - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output + - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'" - rm cabal.project.freeze - - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all | color_cabal_output - - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output + - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all + - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all script: - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) # Packaging... - - ${CABAL} v2-sdist all | color_cabal_output + - ${CABAL} v2-sdist all # Unpacking... - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/ - cd ${DISTDIR} || false @@ -118,23 +114,27 @@ script: - touch cabal.project - | echo "packages: ${PKGDIR_reflex_ghci}" >> cabal.project + - echo 'package reflex-ghci' >> cabal.project + - "echo ' ghc-options: -Werror=missing-methods' >> cabal.project" - | - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(reflex-ghci)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" - cat cabal.project || true - cat cabal.project.local || true # Building... # this builds all libraries and executables (without tests/benchmarks) - - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output + - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all # Building with tests and benchmarks... # build & run tests, build benchmarks - - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output + - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all + # Testing... + - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all # cabal check... - (cd ${PKGDIR_reflex_ghci} && ${CABAL} -vnormal check) # haddock... - - ${CABAL} v2-haddock $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output + - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all # Building without installed constraints for packages in global-db... - rm -f cabal.project.local - - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output + - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all -# REGENDATA ["reflex-ghci.cabal","--output",".travis.yml"] +# REGENDATA ("0.10.2",["reflex-ghci.cabal"]) # EOF From 08aa65158436b79a56cbd36272f70527e50a87e3 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Mon, 8 Jun 2020 14:56:27 -0400 Subject: [PATCH 10/21] Simplify default.nix --- default.nix | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/default.nix b/default.nix index 9ae29a8..4c1957f 100644 --- a/default.nix +++ b/default.nix @@ -1,30 +1 @@ -{ mkDerivation, base, bytestring, dependent-sum, directory -, filepath, fsnotify, mtl, optparse-applicative, primitive, process -, ref-tf, reflex, reflex-fsnotify, reflex-process, reflex-vty -, regex-tdfa, stdenv, temporary, text, unix, vty, which -, ghc -}: -mkDerivation { - pname = "reflex-ghci"; - version = "0.1.4.0"; - src = ./.; - isLibrary = true; - isExecutable = true; - libraryHaskellDepends = [ - base bytestring directory filepath fsnotify process reflex - reflex-fsnotify reflex-process reflex-vty regex-tdfa text unix vty - ]; - executableHaskellDepends = [ - base optparse-applicative process reflex reflex-process reflex-vty - text vty - ]; - testHaskellDepends = [ - base bytestring dependent-sum directory mtl primitive process - ref-tf reflex reflex-process reflex-vty temporary text which - ]; - testToolDepends = [ - ghc - ]; - description = "A GHCi widget library for use in reflex applications"; - license = stdenv.lib.licenses.bsd3; -} +{ callCabal2nix }: callCabal2nix "reflex-ghci" ./. {} From db55842f0922de186dc8a78bd34e546383976215 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Mon, 8 Jun 2020 14:59:07 -0400 Subject: [PATCH 11/21] Move source filtering to default.nix --- default.nix | 12 +++++++++++- release.nix | 12 +----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/default.nix b/default.nix index 4c1957f..97617be 100644 --- a/default.nix +++ b/default.nix @@ -1 +1,11 @@ -{ callCabal2nix }: callCabal2nix "reflex-ghci" ./. {} +{ callCabal2nix }: +let + src = builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) [ + "release.nix" + ".git" + "dist" + "dist-newstyle" + "cabal.project" + ".travis.yml" + ])) ./.; +in callCabal2nix "reflex-ghci" src {} diff --git a/release.nix b/release.nix index ab3b5e6..0e25b2a 100644 --- a/release.nix +++ b/release.nix @@ -28,14 +28,4 @@ } {}; }) ]; -}).ghc.callPackage - (builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) [ - "release.nix" - ".git" - "dist" - "dist-newstyle" - "cabal.project" - ".travis.yml" - ])) ./. - ) - {} +}).ghc.callPackage ./default.nix {} From 45461108ada6dcb6fc8fa470552f5afd8100a183 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Mon, 8 Jun 2020 14:59:20 -0400 Subject: [PATCH 12/21] Bump reflex-platform for CI --- reflex-platform/default.nix | 7 +------ reflex-platform/github.json | 7 ++++--- reflex-platform/thunk.nix | 9 +++++++++ 3 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 reflex-platform/thunk.nix diff --git a/reflex-platform/default.nix b/reflex-platform/default.nix index 7a04778..2b4d4ab 100644 --- a/reflex-platform/default.nix +++ b/reflex-platform/default.nix @@ -1,7 +1,2 @@ # DO NOT HAND-EDIT THIS FILE -import ((import {}).fetchFromGitHub ( - let json = builtins.fromJSON (builtins.readFile ./github.json); - in { inherit (json) owner repo rev sha256; - private = json.private or false; - } -)) +import (import ./thunk.nix) \ No newline at end of file diff --git a/reflex-platform/github.json b/reflex-platform/github.json index e897d49..8d9fa9b 100644 --- a/reflex-platform/github.json +++ b/reflex-platform/github.json @@ -1,7 +1,8 @@ { "owner": "reflex-frp", "repo": "reflex-platform", - "branch": "aa-bump-reflex-process", - "rev": "22f8ea48c15d2be6af6808826a63c6b03eb672c8", - "sha256": "08i6wvgwcmnlnncq66hjhagk45kyiy5ldi15vfm007fvv1kgnamm" + "branch": "master", + "private": false, + "rev": "c13cb19f49c8093de4718d2aced1930128476cfa", + "sha256": "0v87ilal9355xwz8y9m0zh14pm9c0f7pqch0854kkj92ybc5l62q" } diff --git a/reflex-platform/thunk.nix b/reflex-platform/thunk.nix new file mode 100644 index 0000000..bbf2dc1 --- /dev/null +++ b/reflex-platform/thunk.nix @@ -0,0 +1,9 @@ +# DO NOT HAND-EDIT THIS FILE +let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }: + if !fetchSubmodules && !private then builtins.fetchTarball { + url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256; + } else (import {}).fetchFromGitHub { + inherit owner repo rev sha256 fetchSubmodules private; + }; + json = builtins.fromJSON (builtins.readFile ./github.json); +in fetch json \ No newline at end of file From d0d4c34c92bb5ed4986e0d545a13188f2a4865af Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Mon, 8 Jun 2020 15:44:19 -0400 Subject: [PATCH 13/21] test: Delay copying the file a bit to increase chance that fsnotify sees the change --- tests/test.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test.hs b/tests/test.hs index 2a593c5..d4d21df 100644 --- a/tests/test.hs +++ b/tests/test.hs @@ -2,7 +2,7 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TemplateHaskell #-} + import HeadlessHost import Reflex import Reflex.Process.GHCi @@ -18,6 +18,7 @@ import qualified System.Process as P import System.Directory import System.Environment import System.IO.Temp +import Control.Concurrent ghciExe :: FilePath ghciExe = "ghci" @@ -190,11 +191,10 @@ watchAndReloadTest = withSystemTempDirectory "reflex-ghci-test" $ \p -> do _ -> Nothing numFailures :: Dynamic t Int <- count loadFailed performEvent_ $ ffor loadFailed $ \_ -> liftIO $ do + threadDelay 1000000 -- If we respond too quickly, fsnotify won't deliver the change. putStrLn "copying fixed file" - P.callProcess "cp" - [ src <> "/tests/lib-pkg/src/MyLib/Three.hs" - , p <> "/lib-pkg-err/src/MyLib/Three.hs" - ] + copyFile (src <> "/tests/lib-pkg/src/MyLib/Three.hs") + (p <> "/lib-pkg-err/src/MyLib/Three.hs") let loadSucceeded = fforMaybe (updated $ _ghci_status g) $ \case Status_LoadSucceeded -> Just () _ -> Nothing From b6e6239bc0e6f11c0a97e1a76f43711e67fc73e8 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Mon, 8 Jun 2020 15:51:37 -0400 Subject: [PATCH 14/21] test: Make sure watchAndReloadTest doesn't finish early --- tests/test.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test.hs b/tests/test.hs index d4d21df..d1b8760 100644 --- a/tests/test.hs +++ b/tests/test.hs @@ -189,12 +189,14 @@ watchAndReloadTest = withSystemTempDirectory "reflex-ghci-test" $ \p -> do let loadFailed = fforMaybe (updated $ _ghci_status g) $ \case Status_LoadFailed -> Just () _ -> Nothing - numFailures :: Dynamic t Int <- count loadFailed + performEvent_ $ ffor loadFailed $ \_ -> liftIO $ do threadDelay 1000000 -- If we respond too quickly, fsnotify won't deliver the change. putStrLn "copying fixed file" copyFile (src <> "/tests/lib-pkg/src/MyLib/Three.hs") (p <> "/lib-pkg-err/src/MyLib/Three.hs") + + numFailures :: Dynamic t Int <- count loadFailed let loadSucceeded = fforMaybe (updated $ _ghci_status g) $ \case Status_LoadSucceeded -> Just () _ -> Nothing @@ -202,7 +204,7 @@ watchAndReloadTest = withSystemTempDirectory "reflex-ghci-test" $ \p -> do if x > 1 then Just $ error "Too many failures." else Nothing - return loadSucceeded + return $ gate ((>= 1) <$> current numFailures) loadSucceeded testModuleLoadFailed :: ( MonadIO m From 1ac2883ab84ef56be08f896b81d17384d326c5b2 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Mon, 8 Jun 2020 16:10:13 -0400 Subject: [PATCH 15/21] test: Don't pick base constraints in test scaffolding --- tests/exe-pkg/tests.cabal | 2 +- tests/lib-pkg-err/test-pkg2.cabal | 2 +- tests/lib-pkg/test-pkg2.cabal | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/exe-pkg/tests.cabal b/tests/exe-pkg/tests.cabal index a9edcfc..c277e79 100644 --- a/tests/exe-pkg/tests.cabal +++ b/tests/exe-pkg/tests.cabal @@ -20,7 +20,7 @@ executable tests main-is: Main.hs -- other-modules: -- other-extensions: - build-depends: base >=4.12 && <4.13 + build-depends: base , reflex-ghci -- hs-source-dirs: default-language: Haskell2010 diff --git a/tests/lib-pkg-err/test-pkg2.cabal b/tests/lib-pkg-err/test-pkg2.cabal index fb0a0a1..2ed7900 100644 --- a/tests/lib-pkg-err/test-pkg2.cabal +++ b/tests/lib-pkg-err/test-pkg2.cabal @@ -23,6 +23,6 @@ library MyLib.Three -- other-modules: -- other-extensions: - build-depends: base >=4.12 && <4.13 + build-depends: base hs-source-dirs: src default-language: Haskell2010 diff --git a/tests/lib-pkg/test-pkg2.cabal b/tests/lib-pkg/test-pkg2.cabal index fb0a0a1..2ed7900 100644 --- a/tests/lib-pkg/test-pkg2.cabal +++ b/tests/lib-pkg/test-pkg2.cabal @@ -23,6 +23,6 @@ library MyLib.Three -- other-modules: -- other-extensions: - build-depends: base >=4.12 && <4.13 + build-depends: base hs-source-dirs: src default-language: Haskell2010 From 0d31b58737d50fd3ab62fa4be77cbea957a3e1f6 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Mon, 8 Jun 2020 16:14:19 -0400 Subject: [PATCH 16/21] test: Implement file-copy delay correctly --- tests/test.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test.hs b/tests/test.hs index d1b8760..3c318d0 100644 --- a/tests/test.hs +++ b/tests/test.hs @@ -190,8 +190,8 @@ watchAndReloadTest = withSystemTempDirectory "reflex-ghci-test" $ \p -> do Status_LoadFailed -> Just () _ -> Nothing - performEvent_ $ ffor loadFailed $ \_ -> liftIO $ do - threadDelay 1000000 -- If we respond too quickly, fsnotify won't deliver the change. + loadFailedDelayed <- delay 1 loadFailed -- If we respond too quickly, fsnotify won't deliver the change. + performEvent_ $ ffor loadFailedDelayed $ \_ -> liftIO $ do putStrLn "copying fixed file" copyFile (src <> "/tests/lib-pkg/src/MyLib/Three.hs") (p <> "/lib-pkg-err/src/MyLib/Three.hs") From c9bbaedca36ee388de370095d36b481d4e68ced2 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Mon, 8 Jun 2020 16:22:39 -0400 Subject: [PATCH 17/21] Revert GHC 8.8 support because tests don't pass --- .travis.yml | 3 --- reflex-ghci.cabal | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 55eaccc..a365ee7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,9 +33,6 @@ before_cache: - rm -rfv $CABALHOME/packages/head.hackage jobs: include: - - compiler: ghc-8.8.3 - addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.3","cabal-install-3.2"]}} - os: linux - compiler: ghc-8.6.5 addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.2"]}} os: linux diff --git a/reflex-ghci.cabal b/reflex-ghci.cabal index c2056fb..b326c1b 100644 --- a/reflex-ghci.cabal +++ b/reflex-ghci.cabal @@ -18,14 +18,14 @@ build-type: Simple extra-source-files: ChangeLog.md README.md screenshot.png -tested-with: GHC ==8.6.5 || ==8.8.3 +tested-with: GHC ==8.6.5 library exposed-modules: Reflex.Process.GHCi Reflex.Vty.GHCi build-depends: - base >= 4.12 && < 4.14 + base >= 4.12 && < 4.13 , bytestring >= 0.10 && < 0.11 , directory >= 1.3 && < 1.4 , filepath >= 1.4 && < 1.5 From c22c0c86f345a9b07a0462cf60124eeb7ec3aa82 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Mon, 8 Jun 2020 16:27:48 -0400 Subject: [PATCH 18/21] test: Fix auto-generated Travis CI config to work for reflex-ghci tests --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a365ee7..34df4b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -124,7 +124,8 @@ script: # build & run tests, build benchmarks - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all # Testing... - - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all + - export PATH="$(dirname "$HC"):$PATH" # MANUAL ADDITION + - (cd ${PKGDIR_reflex_ghci} && ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all) # MANUAL MODIFICATION # cabal check... - (cd ${PKGDIR_reflex_ghci} && ${CABAL} -vnormal check) # haddock... From 32f3a216550606c2141e711f159737c8e0997ff0 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Mon, 8 Jun 2020 23:46:13 -0400 Subject: [PATCH 19/21] test: Include test fixtures in extra-source-files --- reflex-ghci.cabal | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/reflex-ghci.cabal b/reflex-ghci.cabal index b326c1b..44a4754 100644 --- a/reflex-ghci.cabal +++ b/reflex-ghci.cabal @@ -1,4 +1,4 @@ -cabal-version: >=1.10 +cabal-version: 2.4 name: reflex-ghci version: 0.1.4.0 synopsis: A GHCi widget library for use in reflex applications @@ -8,7 +8,7 @@ description: <> . bug-reports: https://github.com/reflex-frp/reflex-ghci/issues -license: BSD3 +license: BSD-3-Clause license-file: LICENSE author: Obsidian Systems LLC maintainer: maintainer@obsidian.systems @@ -18,6 +18,8 @@ build-type: Simple extra-source-files: ChangeLog.md README.md screenshot.png + tests/**/*.hs + tests/**/*.cabal tested-with: GHC ==8.6.5 library @@ -56,6 +58,7 @@ executable reflex-ghci , reflex-process , text , vty + autogen-modules: Paths_reflex_ghci other-modules: Paths_reflex_ghci ghc-options: -threaded -rtsopts default-language: Haskell2010 From d4a0a06e62c1726566028056998aefe3cb502639 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Tue, 9 Jun 2020 11:14:28 -0400 Subject: [PATCH 20/21] test: Remove redundant import --- tests/test.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test.hs b/tests/test.hs index 3c318d0..32a776e 100644 --- a/tests/test.hs +++ b/tests/test.hs @@ -18,7 +18,6 @@ import qualified System.Process as P import System.Directory import System.Environment import System.IO.Temp -import Control.Concurrent ghciExe :: FilePath ghciExe = "ghci" From 3fd57392062c1e8c43e1ee6d7ae19163aaa7b799 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Tue, 9 Jun 2020 11:17:47 -0400 Subject: [PATCH 21/21] Release 0.1.4.1 --- ChangeLog.md | 8 ++++++++ reflex-ghci.cabal | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index c98ae13..4b4e620 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,13 @@ # Revision history for reflex-ghci +## 0.1.4.1 + +* Library: Require at least version 0.7.1 of `reflex`. +* Library: Require at least version 0.3 of `reflex-process`. +* Library: Expand version bounds for `regex-tdfa` and `vty`. +* Tests: Include test fixtures in sdist. +* Tests: Fix some bugs. + ## 0.1.4.0 * Library: Export `shutdown` and `getExitEvent` to make it easier for library users to cleanly exit diff --git a/reflex-ghci.cabal b/reflex-ghci.cabal index 1673e74..e7e2c6b 100644 --- a/reflex-ghci.cabal +++ b/reflex-ghci.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: reflex-ghci -version: 0.1.4.0 +version: 0.1.4.1 synopsis: A GHCi widget library for use in reflex applications description: Run GHCi from within a reflex application and interact with it using a functional-reactive interface. @@ -52,7 +52,7 @@ executable reflex-ghci base , optparse-applicative >= 0.14.0 && < 0.16 , process - , reflex + , reflex >= 0.7.1.0 , reflex-ghci , reflex-vty , reflex-process