on develop help sign in
Add NotReady
commitebff8c65d092ae47a47da74a5aa696b4a44f547c authorAli Abrar <aliabrar@gmail.com> dateTue 27 Feb 2018, 14:47 (9 years ago) parente387279
3 files changed+22
reflex-vty.cabal+1 src/Reflex/Spider/Orphans.hs+17 src/Reflex/Vty.hs+4
reflex-vty.cabal+1
@@ -12,6 +12,7 @@ cabal-version: >=1.10
1212
1313library
1414 exposed-modules: Reflex.Vty
15+ other-modules: Reflex.Spider.Orphans
1516 build-depends:
1617 base,
1718 dependent-sum,
src/Reflex/Spider/Orphans.hsnew file+17
@@ -0,0 +1,17 @@
1+{-# LANGUAGE FlexibleInstances #-}
2+{-# LANGUAGE MultiParamTypeClasses #-}
3+{-# OPTIONS_GHC -fno-warn-orphans #-}
4+module Reflex.Spider.Orphans where
5+
6+import Reflex
7+import Reflex.NotReady.Class
8+import Reflex.Spider.Internal
9+
10+-- TODO move this to reflex
11+instance NotReady (SpiderTimeline x) (SpiderHost x) where
12+ notReadyUntil _ = pure ()
13+ notReady = pure ()
14+
15+instance HasSpiderTimeline x => NotReady (SpiderTimeline x) (PerformEventT (SpiderTimeline x) (SpiderHost x)) where
16+ notReadyUntil _ = pure ()
17+ notReady = pure ()
src/Reflex/Vty.hs+4
@@ -1,4 +1,5 @@
11{-# LANGUAGE FlexibleContexts #-}
2+{-# LANGUAGE FlexibleInstances #-}
23{-# LANGUAGE LambdaCase #-}
34{-# LANGUAGE MultiParamTypeClasses #-}
45{-# LANGUAGE RankNTypes #-}
@@ -27,6 +28,8 @@ import Data.Maybe (catMaybes)
2728
2829import Reflex
2930import Reflex.Host.Class
31+import Reflex.NotReady.Class
32+import Reflex.Spider.Orphans ()
3033import qualified Graphics.Vty as V
3134
3235-- | The output of a 'VtyApp'.
@@ -49,6 +52,7 @@ type VtyApp t m =
4952 , Ref m ~ IORef
5053 , Ref (HostFrame t) ~ IORef
5154 , MonadRef (HostFrame t)
55+ , NotReady t (PerformEventT t m)
5256 )
5357 => Event t (V.Event)
5458 -- ^ Vty input events.