on develop help sign in
Get rid of most of the warnings
7098fd9Ryan Trinkle
reflex.cabal−1
@@ -37,7 +37,6 @@ library
37 Reflex.Dynamic.TH,
37 Reflex.Dynamic.TH,
38 Reflex.Host.Class,
38 Reflex.Host.Class,
39 Data.Functor.Misc,
39 Data.Functor.Misc,
40− Control.Monad.TypedId,
41 Control.Monad.Ref
40 Control.Monad.Ref
42
41
43 other-extensions: TemplateHaskell
42 other-extensions: TemplateHaskell
src/Control/Monad/TypedId.hsdeleted−50
@@ -1,50 +0,0 @@
1−{-# LANGUAGE TypeFamilies, FlexibleContexts #-}
2−module Control.Monad.TypedId ( MonadTypedId (..)
3− ) where
4−
5−import Data.GADT.Compare
6−import Data.IORef
7−
8−import Control.Monad.State
9−import Control.Monad.Reader
10−
11−import Unsafe.Coerce
12−import System.IO.Unsafe
13−
14−class (Monad m, GCompare (TypedId m)) => MonadTypedId m where
15− type TypedId m :: * -> *
16− getTypedId :: m (TypedId m a)
17−
18−nextTypedIdIO :: IORef Int
19−{-# NOINLINE nextTypedIdIO #-}
20−nextTypedIdIO = unsafePerformIO $ newIORef 1
21−
22−newtype TypedId_IO a = TypedId_IO Int deriving (Show)
23−
24−instance MonadTypedId IO where
25− type TypedId IO = TypedId_IO
26− {-# INLINE getTypedId #-}
27− getTypedId = do
28− n <- atomicModifyIORef' nextTypedIdIO $ \n -> (succ n, n)
29− return $ TypedId_IO n
30−
31−instance GCompare TypedId_IO where
32− {-# INLINE gcompare #-}
33− TypedId_IO a `gcompare` TypedId_IO b = case a `compare` b of
34− LT -> GLT
35− EQ -> unsafeCoerce GEQ
36− GT -> GGT
37−
38−instance GEq TypedId_IO where
39− {-# INLINE geq #-}
40− TypedId_IO a `geq` TypedId_IO b = if a == b then Just $ unsafeCoerce Refl else Nothing
41−
42−instance MonadTypedId m => MonadTypedId (StateT s m) where
43− type TypedId (StateT s m) = TypedId m
44− {-# INLINE getTypedId #-}
45− getTypedId = lift getTypedId
46−
47−instance MonadTypedId m => MonadTypedId (ReaderT r m) where
48− type TypedId (ReaderT r m) = TypedId m
49− {-# INLINE getTypedId #-}
50− getTypedId = lift getTypedId
src/Reflex/Class.hs−2
@@ -6,7 +6,6 @@ import Prelude hiding (mapM, mapM_, sequence, sequence_, foldl)
6import Control.Monad.Identity hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
6import Control.Monad.Identity hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
7import Control.Monad.State.Strict hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
7import Control.Monad.State.Strict hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
8import Control.Monad.Reader hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
8import Control.Monad.Reader hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
9−import Control.Monad.Writer hiding (mapM, mapM_, forM, forM_, sequence, sequence_, (<>))
10import Data.List.NonEmpty (NonEmpty (..))
9import Data.List.NonEmpty (NonEmpty (..))
11import Data.These
10import Data.These
12import Data.Align
11import Data.Align
@@ -14,7 +13,6 @@ import Data.GADT.Compare (GEq (..), (:~:) (..))
14import Data.GADT.Show (GShow (..))
13import Data.GADT.Show (GShow (..))
15import Data.Dependent.Sum (ShowTag (..))
14import Data.Dependent.Sum (ShowTag (..))
16import Data.Map (Map)
15import Data.Map (Map)
17−import qualified Data.Map as Map
18import Data.Dependent.Map (DMap, DSum (..), GCompare (..), GOrdering (..))
16import Data.Dependent.Map (DMap, DSum (..), GCompare (..), GOrdering (..))
19import qualified Data.Dependent.Map as DMap
17import qualified Data.Dependent.Map as DMap
20import Data.Functor.Misc
18import Data.Functor.Misc
src/Reflex/Dynamic.hs+2−21
@@ -71,11 +71,9 @@ hRevApp :: HList l1 -> HList l2 -> HList (HRevApp l1 l2)
71hRevApp HNil l = l
71hRevApp HNil l = l
72hRevApp (HCons x l) l' = hRevApp l (HCons x l')
72hRevApp (HCons x l) l' = hRevApp l (HCons x l')
73
73
74+hReverse :: HList l -> HList (HRevApp l '[])
74hReverse l = hRevApp l HNil
75hReverse l = hRevApp l HNil
75
76
76−hEnd :: HList l -> HList l
77−hEnd = id
78−
79hBuild :: (HBuild' '[] r) => r
77hBuild :: (HBuild' '[] r) => r
80hBuild = hBuild' HNil
78hBuild = hBuild' HNil
81
79
@@ -314,19 +312,6 @@ data FHList f l where
314 FHNil :: FHList f '[]
312 FHNil :: FHList f '[]
315 FHCons :: f e -> FHList f l -> FHList f (e ': l)
313 FHCons :: f e -> FHList f l -> FHList f (e ': l)
316
314
317−natMap :: (forall a. f a -> g a) -> FHList f l -> FHList g l
318−natMap f = \case
319− FHNil -> FHNil
320− h `FHCons` t -> f h `FHCons` natMap f t
321−
322−sequenceFHList :: Monad m => FHList m l -> m (HList l)
323−sequenceFHList = \case
324− FHNil -> return HNil
325− h `FHCons` t -> do
326− hResult <- h
327− tResult <- sequenceFHList t
328− return $ hResult `HCons` tResult
329−
330instance GEq (HListPtr l) where
315instance GEq (HListPtr l) where
331 HHeadPtr `geq` HHeadPtr = Just Refl
316 HHeadPtr `geq` HHeadPtr = Just Refl
332 HHeadPtr `geq` HTailPtr _ = Nothing
317 HHeadPtr `geq` HTailPtr _ = Nothing
@@ -362,11 +347,7 @@ instance RebuildSortedHList t => RebuildSortedHList (h ': t) where
362 rebuildSortedFHList ((WrapArg HHeadPtr :=> h) : t) = FHCons h $ rebuildSortedFHList $ map (\(WrapArg (HTailPtr p) :=> v) -> WrapArg p :=> v) t
347 rebuildSortedFHList ((WrapArg HHeadPtr :=> h) : t) = FHCons h $ rebuildSortedFHList $ map (\(WrapArg (HTailPtr p) :=> v) -> WrapArg p :=> v) t
363 rebuildSortedHList ((HHeadPtr :=> h) : t) = HCons h $ rebuildSortedHList $ map (\(HTailPtr p :=> v) -> p :=> v) t
348 rebuildSortedHList ((HHeadPtr :=> h) : t) = HCons h $ rebuildSortedHList $ map (\(HTailPtr p :=> v) -> p :=> v) t
364
349
365−
366−dmapToFHList :: forall f l. RebuildSortedHList l => DMap (WrapArg f (HListPtr l)) -> FHList f l
367−dmapToFHList = rebuildSortedFHList . DMap.toList
368−
369−dmapToHList :: forall f l. RebuildSortedHList l => DMap (HListPtr l) -> HList l
350+dmapToHList :: forall l. RebuildSortedHList l => DMap (HListPtr l) -> HList l
370dmapToHList = rebuildSortedHList . DMap.toList
351dmapToHList = rebuildSortedHList . DMap.toList
371
352
372distributeFHListOverDyn :: forall t m l. (Reflex t, MonadHold t m, RebuildSortedHList l) => FHList (Dynamic t) l -> m (Dynamic t (HList l))
353distributeFHListOverDyn :: forall t m l. (Reflex t, MonadHold t m, RebuildSortedHList l) => FHList (Dynamic t) l -> m (Dynamic t (HList l))
src/Reflex/Dynamic/TH.hs−1
@@ -5,7 +5,6 @@ import Reflex.Dynamic
5
5
6import Language.Haskell.TH
6import Language.Haskell.TH
7import Data.Data
7import Data.Data
8−import Control.Monad
9import Control.Monad.State
8import Control.Monad.State
10
9
11-- | Quote a Dynamic expression. Within the quoted expression, you can use '$(unqDyn [| x |])' to refer to any expression 'x' of type 'Dynamic t a'; the unquoted result will be of type 'a'
10-- | Quote a Dynamic expression. Within the quoted expression, you can use '$(unqDyn [| x |])' to refer to any expression 'x' of type 'Dynamic t a'; the unquoted result will be of type 'a'
src/Reflex/Host/Class.hs+1−2
@@ -5,7 +5,6 @@ import Prelude hiding (mapM, mapM_, sequence, sequence_, foldl)
5
5
6import Reflex.Class
6import Reflex.Class
7
7
8−import Control.Monad.Identity hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
9import Control.Monad.State.Strict hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
8import Control.Monad.State.Strict hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
10import Control.Monad.Reader hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
9import Control.Monad.Reader hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
11import Data.Dependent.Sum (DSum)
10import Data.Dependent.Sum (DSum)
@@ -47,10 +46,10 @@ newEventWithTriggerRef = do
47
46
48instance (Reflex t, MonadReflexCreateTrigger t m) => MonadReflexCreateTrigger t (ReaderT r m) where
47instance (Reflex t, MonadReflexCreateTrigger t m) => MonadReflexCreateTrigger t (ReaderT r m) where
49 newEventWithTrigger initializer = do
48 newEventWithTrigger initializer = do
50− r <- ask
51 lift $ newEventWithTrigger initializer
49 lift $ newEventWithTrigger initializer
52
50
53instance (Reflex t, MonadReflexHost t m) => MonadReflexHost t (ReaderT r m) where
51instance (Reflex t, MonadReflexHost t m) => MonadReflexHost t (ReaderT r m) where
54 fireEventsAndRead dm a = lift $ fireEventsAndRead dm a
52 fireEventsAndRead dm a = lift $ fireEventsAndRead dm a
55 subscribeEvent = lift . subscribeEvent
53 subscribeEvent = lift . subscribeEvent
56 runFrame = lift . runFrame
54 runFrame = lift . runFrame
55+ runHostFrame = lift . runHostFrame
src/Reflex/Spider/Internal.hs+3−9
@@ -22,7 +22,6 @@ import Data.Maybe
22import Data.IntMap (IntMap)
22import Data.IntMap (IntMap)
23import qualified Data.IntMap as IntMap
23import qualified Data.IntMap as IntMap
24import Control.Lens hiding (coerce)
24import Control.Lens hiding (coerce)
25−import Control.Monad.TypedId
26import Control.Monad.Ref
25import Control.Monad.Ref
27import Data.Monoid ((<>))
26import Data.Monoid ((<>))
28
27
@@ -452,6 +451,7 @@ newRoot = do
452 , rootInit = const $ return $ return ()
451 , rootInit = const $ return $ return ()
453 }
452 }
454
453
454+propagateAndUpdateSubscribersRef :: IORef [WeakSubscriber a] -> a -> EventM ()
455propagateAndUpdateSubscribersRef subscribersRef a = do
455propagateAndUpdateSubscribersRef subscribersRef a = do
456 subscribers <- liftIO $ readIORef subscribersRef
456 subscribers <- liftIO $ readIORef subscribersRef
457 liftIO $ writeIORef subscribersRef []
457 liftIO $ writeIORef subscribersRef []
@@ -1278,13 +1278,6 @@ instance R.MonadReadEvent Spider ResultM where
1278 {-# INLINE readEvent #-}
1278 {-# INLINE readEvent #-}
1279 readEvent = liftM (fmap return) . readEvent . unSpiderEvent
1279 readEvent = liftM (fmap return) . readEvent . unSpiderEvent
1280
1280
1281−--TODO: Can probably get rid of this now that we're not using it for performEvent
1282−instance MonadTypedId EventM where
1283− type TypedId EventM = TypedId IO
1284− {-# INLINE getTypedId #-}
1285− getTypedId = do
1286− liftIO getTypedId
1287−
1288instance MonadRef EventM where
1281instance MonadRef EventM where
1289 type Ref EventM = Ref IO
1282 type Ref EventM = Ref IO
1290 {-# INLINE newRef #-}
1283 {-# INLINE newRef #-}
@@ -1307,7 +1300,8 @@ instance R.MonadHold Spider SpiderHostFrame where
1307 {-# INLINE hold #-}
1300 {-# INLINE hold #-}
1308 hold v0 e = SpiderHostFrame $ R.hold v0 e
1301 hold v0 e = SpiderHostFrame $ R.hold v0 e
1309
1302
1310−newEventWithTriggerIO f= do
1303+newEventWithTriggerIO :: (RootTrigger a -> IO (IO ())) -> IO (R.Event Spider a)
1304+newEventWithTriggerIO f = do
1311 occRef <- newIORef Nothing
1305 occRef <- newIORef Nothing
1312 subscribedRef <- newIORef Nothing
1306 subscribedRef <- newIORef Nothing
1313 let !r = Root
1307 let !r = Root