on develop help sign in
Get rid of most of the warnings
commit7098fd9ebec178b23a018dbd06491b4b1fe73fe1 authorRyan Trinkle <ryan.trinkle@gmail.com> dateTue 24 Mar 2015, 12:42 (12 years ago) parentd81cdeb
7 files changed+6−86
reflex.cabal−1 src/Control/Monad/TypedId.hs−50 src/Reflex/Class.hs−2 src/Reflex/Dynamic.hs+2−21 src/Reflex/Dynamic/TH.hs−1 src/Reflex/Host/Class.hs+1−2 src/Reflex/Spider/Internal.hs+3−9
reflex.cabal−1
@@ -37,7 +37,6 @@ library
3737 Reflex.Dynamic.TH,
3838 Reflex.Host.Class,
3939 Data.Functor.Misc,
40− Control.Monad.TypedId,
4140 Control.Monad.Ref
4241
4342 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)
66import Control.Monad.Identity hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
77import Control.Monad.State.Strict hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
88import Control.Monad.Reader hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
9−import Control.Monad.Writer hiding (mapM, mapM_, forM, forM_, sequence, sequence_, (<>))
109import Data.List.NonEmpty (NonEmpty (..))
1110import Data.These
1211import Data.Align
@@ -14,7 +13,6 @@ import Data.GADT.Compare (GEq (..), (:~:) (..))
1413import Data.GADT.Show (GShow (..))
1514import Data.Dependent.Sum (ShowTag (..))
1615import Data.Map (Map)
17−import qualified Data.Map as Map
1816import Data.Dependent.Map (DMap, DSum (..), GCompare (..), GOrdering (..))
1917import qualified Data.Dependent.Map as DMap
2018import Data.Functor.Misc
src/Reflex/Dynamic.hs+2−21
@@ -71,11 +71,9 @@ hRevApp :: HList l1 -> HList l2 -> HList (HRevApp l1 l2)
7171hRevApp HNil l = l
7272hRevApp (HCons x l) l' = hRevApp l (HCons x l')
7373
74+hReverse :: HList l -> HList (HRevApp l '[])
7475hReverse l = hRevApp l HNil
7576
76−hEnd :: HList l -> HList l
77−hEnd = id
78−
7977hBuild :: (HBuild' '[] r) => r
8078hBuild = hBuild' HNil
8179
@@ -314,19 +312,6 @@ data FHList f l where
314312 FHNil :: FHList f '[]
315313 FHCons :: f e -> FHList f l -> FHList f (e ': l)
316314
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−
330315instance GEq (HListPtr l) where
331316 HHeadPtr `geq` HHeadPtr = Just Refl
332317 HHeadPtr `geq` HTailPtr _ = Nothing
@@ -362,11 +347,7 @@ instance RebuildSortedHList t => RebuildSortedHList (h ': t) where
362347 rebuildSortedFHList ((WrapArg HHeadPtr :=> h) : t) = FHCons h $ rebuildSortedFHList $ map (\(WrapArg (HTailPtr p) :=> v) -> WrapArg p :=> v) t
363348 rebuildSortedHList ((HHeadPtr :=> h) : t) = HCons h $ rebuildSortedHList $ map (\(HTailPtr p :=> v) -> p :=> v) t
364349
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
370351dmapToHList = rebuildSortedHList . DMap.toList
371352
372353distributeFHListOverDyn :: 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
55
66import Language.Haskell.TH
77import Data.Data
8−import Control.Monad
98import Control.Monad.State
109
1110-- | 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)
55
66import Reflex.Class
77
8−import Control.Monad.Identity hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
98import Control.Monad.State.Strict hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
109import Control.Monad.Reader hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
1110import Data.Dependent.Sum (DSum)
@@ -47,10 +46,10 @@ newEventWithTriggerRef = do
4746
4847instance (Reflex t, MonadReflexCreateTrigger t m) => MonadReflexCreateTrigger t (ReaderT r m) where
4948 newEventWithTrigger initializer = do
50− r <- ask
5149 lift $ newEventWithTrigger initializer
5250
5351instance (Reflex t, MonadReflexHost t m) => MonadReflexHost t (ReaderT r m) where
5452 fireEventsAndRead dm a = lift $ fireEventsAndRead dm a
5553 subscribeEvent = lift . subscribeEvent
5654 runFrame = lift . runFrame
55+ runHostFrame = lift . runHostFrame
src/Reflex/Spider/Internal.hs+3−9
@@ -22,7 +22,6 @@ import Data.Maybe
2222import Data.IntMap (IntMap)
2323import qualified Data.IntMap as IntMap
2424import Control.Lens hiding (coerce)
25−import Control.Monad.TypedId
2625import Control.Monad.Ref
2726import Data.Monoid ((<>))
2827
@@ -452,6 +451,7 @@ newRoot = do
452451 , rootInit = const $ return $ return ()
453452 }
454453
454+propagateAndUpdateSubscribersRef :: IORef [WeakSubscriber a] -> a -> EventM ()
455455propagateAndUpdateSubscribersRef subscribersRef a = do
456456 subscribers <- liftIO $ readIORef subscribersRef
457457 liftIO $ writeIORef subscribersRef []
@@ -1278,13 +1278,6 @@ instance R.MonadReadEvent Spider ResultM where
12781278 {-# INLINE readEvent #-}
12791279 readEvent = liftM (fmap return) . readEvent . unSpiderEvent
12801280
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−
12881281instance MonadRef EventM where
12891282 type Ref EventM = Ref IO
12901283 {-# INLINE newRef #-}
@@ -1307,7 +1300,8 @@ instance R.MonadHold Spider SpiderHostFrame where
13071300 {-# INLINE hold #-}
13081301 hold v0 e = SpiderHostFrame $ R.hold v0 e
13091302
1310−newEventWithTriggerIO f= do
1303+newEventWithTriggerIO :: (RootTrigger a -> IO (IO ())) -> IO (R.Event Spider a)
1304+newEventWithTriggerIO f = do
13111305 occRef <- newIORef Nothing
13121306 subscribedRef <- newIORef Nothing
13131307 let !r = Root