From ebff8c65d092ae47a47da74a5aa696b4a44f547c Mon Sep 17 00:00:00 2001 From: Ali Abrar Date: Tue, 27 Feb 2018 14:47:23 -0500 Subject: [PATCH] Add NotReady --- reflex-vty.cabal | 1 + src/Reflex/Spider/Orphans.hs | 17 +++++++++++++++++ src/Reflex/Vty.hs | 4 ++++ 3 files changed, 22 insertions(+) create mode 100644 src/Reflex/Spider/Orphans.hs diff --git a/reflex-vty.cabal b/reflex-vty.cabal index 8a6dc92..fbbb42c 100644 --- a/reflex-vty.cabal +++ b/reflex-vty.cabal @@ -12,6 +12,7 @@ cabal-version: >=1.10 library exposed-modules: Reflex.Vty + other-modules: Reflex.Spider.Orphans build-depends: base, dependent-sum, diff --git a/src/Reflex/Spider/Orphans.hs b/src/Reflex/Spider/Orphans.hs new file mode 100644 index 0000000..2d8b3b6 --- /dev/null +++ b/src/Reflex/Spider/Orphans.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} +module Reflex.Spider.Orphans where + +import Reflex +import Reflex.NotReady.Class +import Reflex.Spider.Internal + +-- TODO move this to reflex +instance NotReady (SpiderTimeline x) (SpiderHost x) where + notReadyUntil _ = pure () + notReady = pure () + +instance HasSpiderTimeline x => NotReady (SpiderTimeline x) (PerformEventT (SpiderTimeline x) (SpiderHost x)) where + notReadyUntil _ = pure () + notReady = pure () diff --git a/src/Reflex/Vty.hs b/src/Reflex/Vty.hs index 8a3444a..10d3a16 100644 --- a/src/Reflex/Vty.hs +++ b/src/Reflex/Vty.hs @@ -1,4 +1,5 @@ {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} @@ -27,6 +28,8 @@ import Data.Maybe (catMaybes) import Reflex import Reflex.Host.Class +import Reflex.NotReady.Class +import Reflex.Spider.Orphans () import qualified Graphics.Vty as V -- | The output of a 'VtyApp'. @@ -49,6 +52,7 @@ type VtyApp t m = , Ref m ~ IORef , Ref (HostFrame t) ~ IORef , MonadRef (HostFrame t) + , NotReady t (PerformEventT t m) ) => Event t (V.Event) -- ^ Vty input events.