From 236101e31a1cd6d771e070840b36018e763d8699 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 5 Jun 2018 06:41:13 -0700 Subject: [PATCH] ui: support/require fsnotify 0.3.0.1+ The api has changed, it supports directory events, and might be more robust. --- hledger-ui/Hledger/UI/Main.hs | 8 ++------ hledger-ui/hledger-ui.cabal | 4 ++-- hledger-ui/package.yaml | 2 +- stack-ghc7.10.yaml | 5 +++++ stack-ghc8.0.yaml | 3 +++ stack-ghc8.2.yaml | 3 +++ stack.yaml | 3 ++- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/hledger-ui/Hledger/UI/Main.hs b/hledger-ui/Hledger/UI/Main.hs index b4b6fa5f3..b7c138b7d 100644 --- a/hledger-ui/Hledger/UI/Main.hs +++ b/hledger-ui/Hledger/UI/Main.hs @@ -212,7 +212,7 @@ runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do d -- predicate: ignore changes not involving our files (\fev -> case fev of - Modified f _ -> f `elem` files + Modified f _ False -> f `elem` files -- Added f _ -> f `elem` files -- Removed f _ -> f `elem` files -- we don't handle adding/removing journal files right now @@ -223,7 +223,7 @@ runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do -- action: send event to app (\fev -> do -- return $ dbglog "fsnotify" $ showFSNEvent fev -- not working - dbg1IO "fsnotify" $ showFSNEvent fev + dbg1IO "fsnotify" $ show fev writeChan eventChan FileChange ) @@ -234,7 +234,3 @@ runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do let myVty = mkVty def #endif void $ customMain myVty (Just eventChan) brickapp ui - -showFSNEvent (Added f _) = "Added " ++ show f -showFSNEvent (Modified f _) = "Modified " ++ show f -showFSNEvent (Removed f _) = "Removed " ++ show f diff --git a/hledger-ui/hledger-ui.cabal b/hledger-ui/hledger-ui.cabal index 8cf97fbd7..7720f0aa7 100644 --- a/hledger-ui/hledger-ui.cabal +++ b/hledger-ui/hledger-ui.cabal @@ -2,7 +2,7 @@ -- -- see: https://github.com/sol/hpack -- --- hash: 76f2079643447fd282a8fb455594f8801e1a011cae69d7d1ec6bc3180dcf583f +-- hash: 82e8763ca935ff359245f2b359e094fe863143d27e58a2d90b0ddb1e3d7c272e name: hledger-ui version: 1.9.99 @@ -75,7 +75,7 @@ executable hledger-ui , data-default , directory , filepath - , fsnotify >=0.2 + , fsnotify >=0.3.0.1 , hledger >=1.9.99 && <2.0 , hledger-lib >=1.9.99 && <2.0 , megaparsec >=6.4.1 diff --git a/hledger-ui/package.yaml b/hledger-ui/package.yaml index ea4ecf2c8..8bac02ce3 100644 --- a/hledger-ui/package.yaml +++ b/hledger-ui/package.yaml @@ -51,7 +51,7 @@ dependencies: - data-default - directory - filepath -- fsnotify >=0.2 +- fsnotify >=0.3.0.1 - HUnit - microlens >=0.4 - microlens-platform >=0.2.3.1 diff --git a/stack-ghc7.10.yaml b/stack-ghc7.10.yaml index 7521a9e1a..e78f964b8 100644 --- a/stack-ghc7.10.yaml +++ b/stack-ghc7.10.yaml @@ -85,3 +85,8 @@ extra-deps: # - th-orphans-0.13.4 # - vty-5.17.1 # - word-wrap-0.4.1 + +# hledger-ui +# newer fsnotify has a different api and may be more robust +- fsnotify-0.3.0.1 +- shelly-1.7.2 diff --git a/stack-ghc8.0.yaml b/stack-ghc8.0.yaml index 231023e20..871967e80 100644 --- a/stack-ghc8.0.yaml +++ b/stack-ghc8.0.yaml @@ -46,3 +46,6 @@ extra-deps: - hashtables-1.2.3.1 # avoid hanging with windows symlinks https://github.com/simonmichael/hledger/issues/791 - directory-1.3.2.2 +# hledger-ui +# newer fsnotify has a different api and may be more robust +- fsnotify-0.3.0.1 diff --git a/stack-ghc8.2.yaml b/stack-ghc8.2.yaml index 886d736c6..c82eeafe8 100644 --- a/stack-ghc8.2.yaml +++ b/stack-ghc8.2.yaml @@ -21,6 +21,9 @@ extra-deps: - hashtables-1.2.3.1 # avoid https://github.com/simonmichael/hledger/issues/791 - directory-1.3.2.2 +# hledger-ui +# newer fsnotify has a different api and may be more robust +- fsnotify-0.3.0.1 nix: pure: false diff --git a/stack.yaml b/stack.yaml index d04993468..d283b5193 100644 --- a/stack.yaml +++ b/stack.yaml @@ -13,7 +13,8 @@ extra-deps: # hledger-lib - easytest-0.1.1 # hledger-ui -- fsnotify-0.2.1.2 +# newer fsnotify has a different api and may be more robust +- fsnotify-0.3.0.1 # hledger-web - json-0.9.2 - wai-handler-launch-3.0.2.4