on develop help sign in
Merge pull request #20 from bennofs/transformers-compat

Fixes for GHC 7.8

commit414f1974e4528c851a8803302ad04e07d4a5181c authorRyan Trinkle <ryan.trinkle@gmail.com> dateMon 13 Jul 2015, 10:49 (11 years ago) parent9e4c6ba2a8a79a
4 files changed+29−21
reflex.cabal+3−1 src/Reflex/Class.hs+9−7 src/Reflex/Host/Class.hs+14−11 src/Reflex/Spider/Internal.hs+3−2
reflex.cabal+3−1
@@ -26,7 +26,9 @@ library
2626 primitive >= 0.5 && < 0.7,
2727 template-haskell >= 2.9 && < 2.11,
2828 ref-tf == 0.4.*,
29− exception-transformers == 0.4.*
29+ exception-transformers == 0.4.*,
30+ transformers >= 0.2,
31+ transformers-compat >= 0.3
3032
3133 exposed-modules:
3234 Reflex,
src/Reflex/Class.hs+9−7
@@ -1,15 +1,14 @@
11{-# LANGUAGE TypeFamilies, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, RankNTypes, GADTs, ScopedTypeVariables, FunctionalDependencies, RecursiveDo, UndecidableInstances, GeneralizedNewtypeDeriving, StandaloneDeriving, EmptyDataDecls, NoMonomorphismRestriction, TypeOperators, DeriveDataTypeable, PackageImports, TemplateHaskell, LambdaCase #-}
22module Reflex.Class where
33
4−import Prelude hiding (mapM, mapM_, sequence, sequence_, foldl)
5−
4+import Control.Applicative
65import Control.Monad.Identity hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
76import Control.Monad.State.Strict hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
87import Control.Monad.Reader hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
9−import Control.Monad.Writer (WriterT())
10−import Control.Monad.Except (ExceptT())
11−import Control.Monad.Cont (ContT())
12−import Control.Monad.RWS (RWST())
8+import Control.Monad.Trans.Writer (WriterT())
9+import Control.Monad.Trans.Except (ExceptT())
10+import Control.Monad.Trans.Cont (ContT())
11+import Control.Monad.Trans.RWS (RWST())
1312import Data.List.NonEmpty (NonEmpty (..))
1413import Data.These
1514import Data.Align
@@ -23,6 +22,9 @@ import Data.Functor.Misc
2322import Data.Semigroup
2423import Data.Traversable
2524
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+
2628import Debug.Trace (trace)
2729
2830class (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
5153 -- | Create an Event that will occur whenever the input event is occurring and its occurrence value, another Event, is also occurring
5254 coincidence :: Event t (Event t a) -> Event t a
5355
54−class Monad m => MonadSample t m | m -> t where
56+class (Applicative m, Monad m) => MonadSample t m | m -> t where
5557 -- | Get the current value in the Behavior
5658 sample :: Behavior t a -> m a
5759
src/Reflex/Host/Class.hs+14−11
@@ -1,21 +1,24 @@
11{-# LANGUAGE ExistentialQuantification, GADTs, ScopedTypeVariables, TypeFamilies, FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving, RankNTypes, BangPatterns, UndecidableInstances, EmptyDataDecls, RecursiveDo, RoleAnnotations, FunctionalDependencies, FlexibleContexts #-}
22module Reflex.Host.Class where
33
4−import Prelude hiding (mapM, mapM_, sequence, sequence_, foldl)
5−
64import Reflex.Class
75
6+import Control.Applicative
87import Control.Monad.Fix
98import Control.Monad.Trans
10−import Control.Monad.Reader (ReaderT())
11−import Control.Monad.Writer (WriterT())
12−import Control.Monad.Cont (ContT())
13−import Control.Monad.Except (ExceptT())
14−import Control.Monad.RWS (RWST())
15−import Control.Monad.State (StateT())
9+import Control.Monad.Trans.Reader (ReaderT())
10+import Control.Monad.Trans.Writer (WriterT())
11+import Control.Monad.Trans.Cont (ContT())
12+import Control.Monad.Trans.Except (ExceptT())
13+import Control.Monad.Trans.RWS (RWST())
14+import Control.Monad.Trans.State (StateT())
1615import Data.Dependent.Sum (DSum)
16+import Data.Monoid
1717import Control.Monad.Ref
1818
19+-- Note: this import must come last to silence warnings from AMP
20+import Prelude hiding (mapM, mapM_, sequence, sequence_, foldl)
21+
1922-- | Framework implementation support class for the reflex implementation represented by @t@.
2023class (Reflex t, MonadReflexCreateTrigger t (HostFrame t), MonadSample t (HostFrame t), MonadHold t (HostFrame t), MonadFix (HostFrame t)) => ReflexHost t where
2124 type EventTrigger t :: * -> *
@@ -23,7 +26,7 @@ class (Reflex t, MonadReflexCreateTrigger t (HostFrame t), MonadSample t (HostFr
2326 type HostFrame t :: * -> *
2427
2528-- | 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
2730 -- | Read the value of an 'Event' from an 'EventHandle' (created by calling 'subscribeEvent').
2831 --
2932 -- 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
3437 readEvent :: EventHandle t a -> m (Maybe (m a))
3538
3639-- | 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
3841 -- | Creates a root 'Event' (one that is not based on any other event).
3942 --
4043 -- When a subscriber first subscribes to an event (building another event
@@ -48,7 +51,7 @@ class Monad m => MonadReflexCreateTrigger t m | m -> t where
4851 -- 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.
4952 newEventWithTrigger :: (EventTrigger t a -> IO (IO ())) -> m (Event t a)
5053
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
5255 -- | Propagate some events firings and read the values of events afterwards.
5356 --
5457 -- 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 @@
11{-# LANGUAGE CPP, ExistentialQuantification, GADTs, ScopedTypeVariables, TypeFamilies, FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving, RankNTypes, BangPatterns, UndecidableInstances, EmptyDataDecls, RecursiveDo, RoleAnnotations, LambdaCase #-}
22module Reflex.Spider.Internal where
33
4−import Prelude hiding (mapM, mapM_, any, sequence, concat)
5−
64import qualified Reflex.Class as R
75import qualified Reflex.Host.Class as R
86
@@ -29,6 +27,9 @@ import System.IO.Unsafe
2927import Unsafe.Coerce
3028import Control.Monad.Primitive
3129
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+
3233debugPropagate :: Bool
3334
3435debugInvalidateHeight :: Bool