on develop help sign in
Merge pull request #22 from reflex-frp/eac@updates

Support GHC 8.8 and other misc updates

commit636c09c38074ba6dc9f4a0cb706a65154884e0dd authorElliot Cameron <3noch@users.noreply.github.com> dateFri 8 May 2020, 10:12 (6 years ago) parent613a786d920b9c
6 files changed+21−20
.travis.yml+3 README.md+1−2 reflex-vty.cabal+6−6 src/Reflex/Class/Switchable.hs+2−3 src/Reflex/Vty/Host.hs+4−5 src/Reflex/Vty/Widget.hs+5−4
.travis.yml+3
@@ -30,11 +30,14 @@ before_cache:
3030
3131matrix:
3232 include:
33+ - compiler: "ghc-8.8.3"
34+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-3.0,ghc-8.8.3], sources: [hvr-ghc]}}
3335 - compiler: "ghc-8.6.5"
3436 addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.5], sources: [hvr-ghc]}}
3537 - compiler: "ghc-8.4.4"
3638 addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.4], sources: [hvr-ghc]}}
3739
40+
3841before_install:
3942 - HC=/opt/ghc/bin/${CC}
4043 - HCPKG=${HC/ghc/ghc-pkg}
README.md+1−2
@@ -33,10 +33,9 @@ Please see the `tested-with` field of the cabal file for known-compatible versio
3333From the reflex-vty project directory:
3434
3535```bash
36+# nix-shell -p cabal-install binutils icu # for nix users
3637cabal new-configure
3738cabal new-build # to build the library and example
3839cabal new-repl # to enter a repl for the library
3940cabal new-repl example # to enter a repl for the example executable
4041```
41−
42−
reflex-vty.cabal+6−6
@@ -18,7 +18,7 @@ extra-source-files: README.md
1818 ChangeLog.md
1919extra-doc-files: doc/welcome.gif
2020 , doc/tasks.png
21−tested-with: GHC ==8.6.5 || ==8.4.4
21+tested-with: GHC ==8.8.3 || ==8.6.5 || ==8.4.4
2222
2323library
2424 exposed-modules: Reflex.Vty
@@ -32,7 +32,7 @@ library
3232 , Reflex.Spider.Orphans
3333 , Control.Monad.NodeId
3434 build-depends:
35− base >= 4.10.0 && < 4.13,
35+ base >= 4.10.0 && < 4.14,
3636 bimap >= 0.3.3 && < 0.4,
3737 containers >= 0.5.0 && < 0.7,
3838 mtl >= 2.2.2 && < 2.3,
@@ -44,11 +44,11 @@ library
4444 text-icu >= 0.7 && < 0.8,
4545 dependent-sum >= 0.3 && < 0.7,
4646 exception-transformers >= 0.4.0 && < 0.5,
47− primitive >= 0.6.3 && < 0.7,
47+ primitive >= 0.6.3 && < 0.8,
4848 ref-tf >= 0.4.0 && < 0.5,
49− reflex >= 0.6.2 && < 0.7,
50− time >= 1.8.0 && < 1.9,
51− vty >= 5.21 && < 5.26
49+ reflex >= 0.6.2 && < 0.8,
50+ time >= 1.8.0 && < 1.10,
51+ vty >= 5.21 && < 5.29
5252 hs-source-dirs: src
5353 default-language: Haskell2010
5454 ghc-options: -Wall
src/Reflex/Class/Switchable.hs+2−3
@@ -4,7 +4,6 @@ Description: A class for things that can be switched on the firing of an event
44-}
55{-# LANGUAGE FlexibleInstances #-}
66{-# LANGUAGE FunctionalDependencies #-}
7−{-# LANGUAGE MultiParamTypeClasses #-}
87{-# LANGUAGE UndecidableInstances #-}
98module Reflex.Class.Switchable where
109
@@ -26,5 +25,5 @@ instance Reflex t => Switchable t (Behavior t a) where
2625
2726instance (Reflex t, Switchable t a, Switchable t b) => Switchable t (a, b) where
2827 switching (a, b) e = (,)
29− <$> (switching a $ fmap fst e)
30− <*> (switching b $ fmap snd e)
28+ <$> switching a (fmap fst e)
29+ <*> switching b (fmap snd e)
src/Reflex/Vty/Host.hs+4−5
@@ -28,8 +28,7 @@ import Control.Monad.Identity (Identity(..))
2828import Control.Monad.Primitive (PrimMonad)
2929import Control.Monad.Ref (MonadRef, Ref, readRef)
3030import Data.Dependent.Sum (DSum ((:=>)))
31−import Data.IORef (IORef)
32−import Data.IORef (readIORef)
31+import Data.IORef (IORef, readIORef)
3332import Data.Maybe (catMaybes)
3433
3534import Reflex
@@ -76,7 +75,7 @@ type MonadVtyApp t m =
7675type VtyApp t m = MonadVtyApp t m
7776 => DisplayRegion
7877 -- ^ The initial display size (updates to this come as events)
79− -> Event t (V.Event)
78+ -> Event t V.Event
8079 -- ^ Vty input events.
8180 -> m (VtyResult t)
8281 -- ^ The output of the 'VtyApp'. The application runs in a context that,
@@ -115,7 +114,7 @@ runVtyAppWithHandle vty vtyGuest = flip onException (V.shutdown vty) $
115114 -- processed.
116115 events <- liftIO newChan
117116
118− displayRegion0 <- V.displayBounds $ V.outputIface vty
117+ displayRegion0 <- liftIO $ V.displayBounds $ V.outputIface vty
119118
120119 -- Run the vty "guest" application, providing the appropriate context. The
121120 -- result is a 'VtyResult', and a 'FireCommand' that will be used to
@@ -179,7 +178,7 @@ runVtyAppWithHandle vty vtyGuest = flip onException (V.shutdown vty) $
179178 triggerInvocation = TriggerInvocation ne $ return ()
180179 -- Write our input event's 'EventTrigger' with the newly created
181180 -- 'TriggerInvocation' value to the queue of events.
182− writeChan events $ [triggerRef :=> triggerInvocation]
181+ writeChan events [triggerRef :=> triggerInvocation]
183182
184183 -- The main application loop. We wait for new events, fire those that
185184 -- have subscribers, and update the display. If we detect a shutdown
src/Reflex/Vty/Widget.hs+5−4
@@ -71,8 +71,9 @@ module Reflex.Vty.Widget
7171
7272import Control.Applicative (liftA2)
7373import Control.Monad.Fix (MonadFix)
74−import Control.Monad.Reader
75−import Control.Monad.Trans (lift)
74+import Control.Monad.IO.Class (MonadIO)
75+import Control.Monad.Reader (ReaderT, ask, asks, runReaderT)
76+import Control.Monad.Trans (MonadTrans, lift)
7677import Data.Default (Default(..))
7778import Data.Set (Set)
7879import qualified Data.Set as Set
@@ -143,7 +144,7 @@ instance MonadTrans (VtyWidget t) where
143144
144145instance MonadNodeId m => MonadNodeId (VtyWidget t m) where
145146 getNextNodeId = VtyWidget $ do
146− lift $ lift $ getNextNodeId
147+ lift $ lift getNextNodeId
147148
148149-- | Runs a 'VtyWidget' with a given context
149150runVtyWidget
@@ -522,7 +523,7 @@ splitVDrag wS wA wB = do
522523 rec splitterCheckpoint <- holdDyn splitter0 $ leftmost [fst <$> ffilter snd dragSplitter, resizeSplitter]
523524 splitterPos <- holdDyn splitter0 $ leftmost [fst <$> dragSplitter, resizeSplitter]
524525 splitterFrac <- holdDyn ((1::Double) / 2) $ ffor (attach (current dh) (fst <$> dragSplitter)) $ \(h, x) ->
525− fromIntegral x / (max 1 (fromIntegral h))
526+ fromIntegral x / max 1 (fromIntegral h)
526527 let dragSplitter = fforMaybe (attach (current splitterCheckpoint) dragE) $
527528 \(splitterY, Drag (_, fromY) (_, toY) _ _ end) ->
528529 if splitterY == fromY then Just (toY, end) else Nothing