diff --git a/hledger-ui/Hledger/UI/Main.hs b/hledger-ui/Hledger/UI/Main.hs index bdfa73de1..7419e2aad 100644 --- a/hledger-ui/Hledger/UI/Main.hs +++ b/hledger-ui/Hledger/UI/Main.hs @@ -3,6 +3,7 @@ hledger-ui - a hledger add-on providing a curses-style interface. Copyright (c) 2007-2015 Simon Michael Released under GPL version 3 or later. -} +{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE MultiParamTypeClasses #-} @@ -11,12 +12,12 @@ module Hledger.UI.Main where -- import Control.Applicative -- import Lens.Micro.Platform ((^.)) -import Control.Concurrent +import Control.Concurrent (threadDelay) import Control.Concurrent.Async import Control.Monad -- import Control.Monad.IO.Class (liftIO) import Data.Default (def) --- import Data.Monoid -- +-- import Data.Monoid -- import Data.List import Data.Maybe -- import Data.Text (Text) @@ -30,6 +31,12 @@ import System.FilePath import System.FSNotify import Brick +#if MIN_VERSION_brick(0,16,0) +import qualified Brick.BChan as BC +#else +import Control.Concurrent.Chan (newChan, writeChan) +#endif + import Hledger import Hledger.Cli hiding (progname,prognameandversion,green) import Hledger.UI.UIOptions @@ -41,6 +48,15 @@ import Hledger.UI.RegisterScreen ---------------------------------------------------------------------- +#if MIN_VERSION_brick(0,16,0) +newChan :: IO (BC.BChan a) +newChan = BC.newBChan 10 + +writeChan :: BC.BChan a -> a -> IO () +writeChan = BC.writeBChan +#endif + + main :: IO () main = do opts <- getHledgerUIOpts @@ -129,7 +145,7 @@ runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do ,aPrevScreens=[] ,aMode=Normal } - + ui = (sInit scr) d True $ (if change_ uopts' then toggleHistorical else id) $ -- XXX diff --git a/hledger-ui/hledger-ui.cabal b/hledger-ui/hledger-ui.cabal index 74837bde2..2f8e93eb0 100644 --- a/hledger-ui/hledger-ui.cabal +++ b/hledger-ui/hledger-ui.cabal @@ -85,7 +85,7 @@ executable hledger-ui buildable: False else build-depends: - brick >= 0.12 && < 0.16 + brick >= 0.12 && < 0.17 , vty >= 5.5 && < 5.15 if flag(threaded) ghc-options: -threaded diff --git a/hledger-ui/package.yaml b/hledger-ui/package.yaml index 959ecea22..f3972c6ff 100644 --- a/hledger-ui/package.yaml +++ b/hledger-ui/package.yaml @@ -88,7 +88,7 @@ executables: buildable: false else: dependencies: - - brick >= 0.12 && < 0.16 + - brick >= 0.12 && < 0.17 - vty >= 5.5 && < 5.15 - condition: flag(threaded) ghc-options: -threaded diff --git a/stack.yaml b/stack.yaml index 289ea1acc..680b775f8 100644 --- a/stack.yaml +++ b/stack.yaml @@ -11,7 +11,7 @@ packages: extra-deps: # for hledger-ui: -- brick-0.15.2 +- brick-0.16 - vty-5.14 - text-zipper-0.8.1 # for hledger-web: