on develop help sign in
Merge pull request #20 from bennofs/transformers-compat
414f197Ryan Trinkle
reflex.cabal+3−1
@@ -26,7 +26,9 @@ library
26 primitive >= 0.5 && < 0.7,
26 primitive >= 0.5 && < 0.7,
27 template-haskell >= 2.9 && < 2.11,
27 template-haskell >= 2.9 && < 2.11,
28 ref-tf == 0.4.*,
28 ref-tf == 0.4.*,
29− exception-transformers == 0.4.*
29+ exception-transformers == 0.4.*,
30+ transformers >= 0.2,
31+ transformers-compat >= 0.3
30
32
31 exposed-modules:
33 exposed-modules:
32 Reflex,
34 Reflex,
src/Reflex/Class.hs+9−7
@@ -1,15 +1,14 @@
1{-# LANGUAGE TypeFamilies, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, RankNTypes, GADTs, ScopedTypeVariables, FunctionalDependencies, RecursiveDo, UndecidableInstances, GeneralizedNewtypeDeriving, StandaloneDeriving, EmptyDataDecls, NoMonomorphismRestriction, TypeOperators, DeriveDataTypeable, PackageImports, TemplateHaskell, LambdaCase #-}
1{-# LANGUAGE TypeFamilies, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, RankNTypes, GADTs, ScopedTypeVariables, FunctionalDependencies, RecursiveDo, UndecidableInstances, GeneralizedNewtypeDeriving, StandaloneDeriving, EmptyDataDecls, NoMonomorphismRestriction, TypeOperators, DeriveDataTypeable, PackageImports, TemplateHaskell, LambdaCase #-}
2module Reflex.Class where
2module Reflex.Class where
3
3
4−import Prelude hiding (mapM, mapM_, sequence, sequence_, foldl)
4+import Control.Applicative
5−
6import Control.Monad.Identity hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
5import Control.Monad.Identity hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
7import Control.Monad.State.Strict hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
6import Control.Monad.State.Strict hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
8import Control.Monad.Reader hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
7import Control.Monad.Reader hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
9−import Control.Monad.Writer (WriterT())
8+import Control.Monad.Trans.Writer (WriterT())
10−import Control.Monad.Except (ExceptT())
9+import Control.Monad.Trans.Except (ExceptT())
11−import Control.Monad.Cont (ContT())
10+import Control.Monad.Trans.Cont (ContT())
12−import Control.Monad.RWS (RWST())
11+import Control.Monad.Trans.RWS (RWST())
13import Data.List.NonEmpty (NonEmpty (..))
12import Data.List.NonEmpty (NonEmpty (..))
14import Data.These
13import Data.These
15import Data.Align
14import Data.Align
@@ -23,6 +22,9 @@ import Data.Functor.Misc
23import Data.Semigroup
22import Data.Semigroup
24import Data.Traversable
23import Data.Traversable
25
24
25+-- Note: must come last to silence warnings due to AMP on GHC < 7.10
26+import Prelude hiding (mapM, mapM_, sequence, sequence_, foldl)
27+
26import Debug.Trace (trace)
28import Debug.Trace (trace)
27
29
28class (MonadHold t (PushM t), MonadSample t (PullM t), Functor (Event t), Functor (Behavior t)) => Reflex t where
30class (MonadHold t (PushM t), MonadSample t (PullM t), Functor (Event t), Functor (Behavior t)) => Reflex t where
@@ -51,7 +53,7 @@ class (MonadHold t (PushM t), MonadSample t (PullM t), Functor (Event t), Functo
51 -- | Create an Event that will occur whenever the input event is occurring and its occurrence value, another Event, is also occurring
53 -- | Create an Event that will occur whenever the input event is occurring and its occurrence value, another Event, is also occurring
52 coincidence :: Event t (Event t a) -> Event t a
54 coincidence :: Event t (Event t a) -> Event t a
53
55
54−class Monad m => MonadSample t m | m -> t where
56+class (Applicative m, Monad m) => MonadSample t m | m -> t where
55 -- | Get the current value in the Behavior
57 -- | Get the current value in the Behavior
56 sample :: Behavior t a -> m a
58 sample :: Behavior t a -> m a
57
59
src/Reflex/Host/Class.hs+14−11
@@ -1,21 +1,24 @@
1{-# LANGUAGE ExistentialQuantification, GADTs, ScopedTypeVariables, TypeFamilies, FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving, RankNTypes, BangPatterns, UndecidableInstances, EmptyDataDecls, RecursiveDo, RoleAnnotations, FunctionalDependencies, FlexibleContexts #-}
1{-# LANGUAGE ExistentialQuantification, GADTs, ScopedTypeVariables, TypeFamilies, FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving, RankNTypes, BangPatterns, UndecidableInstances, EmptyDataDecls, RecursiveDo, RoleAnnotations, FunctionalDependencies, FlexibleContexts #-}
2module Reflex.Host.Class where
2module Reflex.Host.Class where
3
3
4−import Prelude hiding (mapM, mapM_, sequence, sequence_, foldl)
5−
6import Reflex.Class
4import Reflex.Class
7
5
6+import Control.Applicative
8import Control.Monad.Fix
7import Control.Monad.Fix
9import Control.Monad.Trans
8import Control.Monad.Trans
10−import Control.Monad.Reader (ReaderT())
9+import Control.Monad.Trans.Reader (ReaderT())
11−import Control.Monad.Writer (WriterT())
10+import Control.Monad.Trans.Writer (WriterT())
12−import Control.Monad.Cont (ContT())
11+import Control.Monad.Trans.Cont (ContT())
13−import Control.Monad.Except (ExceptT())
12+import Control.Monad.Trans.Except (ExceptT())
14−import Control.Monad.RWS (RWST())
13+import Control.Monad.Trans.RWS (RWST())
15−import Control.Monad.State (StateT())
14+import Control.Monad.Trans.State (StateT())
16import Data.Dependent.Sum (DSum)
15import Data.Dependent.Sum (DSum)
16+import Data.Monoid
17import Control.Monad.Ref
17import Control.Monad.Ref
18
18
19+-- Note: this import must come last to silence warnings from AMP
20+import Prelude hiding (mapM, mapM_, sequence, sequence_, foldl)
21+
19-- | Framework implementation support class for the reflex implementation represented by @t@.
22-- | Framework implementation support class for the reflex implementation represented by @t@.
20class (Reflex t, MonadReflexCreateTrigger t (HostFrame t), MonadSample t (HostFrame t), MonadHold t (HostFrame t), MonadFix (HostFrame t)) => ReflexHost t where
23class (Reflex t, MonadReflexCreateTrigger t (HostFrame t), MonadSample t (HostFrame t), MonadHold t (HostFrame t), MonadFix (HostFrame t)) => ReflexHost t where
21 type EventTrigger t :: * -> *
24 type EventTrigger t :: * -> *
@@ -23,7 +26,7 @@ class (Reflex t, MonadReflexCreateTrigger t (HostFrame t), MonadSample t (HostFr
23 type HostFrame t :: * -> *
26 type HostFrame t :: * -> *
24
27
25-- | Monad that allows to read events' values.
28-- | Monad that allows to read events' values.
26−class (ReflexHost t, Monad m) => MonadReadEvent t m | m -> t where
29+class (ReflexHost t, Applicative m, Monad m) => MonadReadEvent t m | m -> t where
27 -- | Read the value of an 'Event' from an 'EventHandle' (created by calling 'subscribeEvent').
30 -- | Read the value of an 'Event' from an 'EventHandle' (created by calling 'subscribeEvent').
28 --
31 --
29 -- After event propagation is done, all events can be in two states: either they are firing with some value or they are not firing.
32 -- After event propagation is done, all events can be in two states: either they are firing with some value or they are not firing.
@@ -34,7 +37,7 @@ class (ReflexHost t, Monad m) => MonadReadEvent t m | m -> t where
34 readEvent :: EventHandle t a -> m (Maybe (m a))
37 readEvent :: EventHandle t a -> m (Maybe (m a))
35
38
36-- | A monad where new events feed from external sources can be created.
39-- | A monad where new events feed from external sources can be created.
37−class Monad m => MonadReflexCreateTrigger t m | m -> t where
40+class (Applicative m, Monad m) => MonadReflexCreateTrigger t m | m -> t where
38 -- | Creates a root 'Event' (one that is not based on any other event).
41 -- | Creates a root 'Event' (one that is not based on any other event).
39 --
42 --
40 -- When a subscriber first subscribes to an event (building another event
43 -- When a subscriber first subscribes to an event (building another event
@@ -48,7 +51,7 @@ class Monad m => MonadReflexCreateTrigger t m | m -> t where
48 -- Note: An event may be set up multiple times. So after the teardown action is executed, the event may still be set up again in the future.
51 -- Note: An event may be set up multiple times. So after the teardown action is executed, the event may still be set up again in the future.
49 newEventWithTrigger :: (EventTrigger t a -> IO (IO ())) -> m (Event t a)
52 newEventWithTrigger :: (EventTrigger t a -> IO (IO ())) -> m (Event t a)
50
53
51−class (Monad m, ReflexHost t, MonadReflexCreateTrigger t m) => MonadReflexHost t m | m -> t where
54+class (ReflexHost t, MonadReflexCreateTrigger t m) => MonadReflexHost t m | m -> t where
52 -- | Propagate some events firings and read the values of events afterwards.
55 -- | Propagate some events firings and read the values of events afterwards.
53 --
56 --
54 -- This function will create a new frame to fire the given events. It will then update all
57 -- This function will create a new frame to fire the given events. It will then update all
src/Reflex/Spider/Internal.hs+3−2
@@ -1,8 +1,6 @@
1{-# LANGUAGE CPP, ExistentialQuantification, GADTs, ScopedTypeVariables, TypeFamilies, FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving, RankNTypes, BangPatterns, UndecidableInstances, EmptyDataDecls, RecursiveDo, RoleAnnotations, LambdaCase #-}
1{-# LANGUAGE CPP, ExistentialQuantification, GADTs, ScopedTypeVariables, TypeFamilies, FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving, RankNTypes, BangPatterns, UndecidableInstances, EmptyDataDecls, RecursiveDo, RoleAnnotations, LambdaCase #-}
2module Reflex.Spider.Internal where
2module Reflex.Spider.Internal where
3
3
4−import Prelude hiding (mapM, mapM_, any, sequence, concat)
5−
6import qualified Reflex.Class as R
4import qualified Reflex.Class as R
7import qualified Reflex.Host.Class as R
5import qualified Reflex.Host.Class as R
8
6
@@ -29,6 +27,9 @@ import System.IO.Unsafe
29import Unsafe.Coerce
27import Unsafe.Coerce
30import Control.Monad.Primitive
28import Control.Monad.Primitive
31
29
30+-- Note: must come last to silence warnings due to AMP on GHC < 7.10
31+import Prelude hiding (mapM, mapM_, any, sequence, concat)
32+
32debugPropagate :: Bool
33debugPropagate :: Bool
33
34
34debugInvalidateHeight :: Bool
35debugInvalidateHeight :: Bool