packages feed

reflex 0.0.1 → 0.1.0

raw patch · 7 files changed

+18/−96 lines, 7 filesdep −lens

Dependencies removed: lens

Files

reflex.cabal view
@@ -1,5 +1,5 @@ Name: reflex-Version: 0.0.1+Version: 0.1.0 Synopsis: Higher-order Functional Reactive Programming Description: Reflex is a high-performance, deterministic, higher-order Functional Reactive Programming system License: BSD3@@ -10,21 +10,21 @@ Category: FRP Build-type: Simple Cabal-version: >=1.9.2+homepage: https://github.com/ryantrinkle/reflex bug-reports: https://github.com/ryantrinkle/reflex/issues  library   hs-source-dirs: src   build-depends:-    base == 4.8.*,+    base >= 4.7 && < 4.9,     dependent-sum == 0.2.*,     dependent-map == 0.1.*,     semigroups == 0.16.*,     mtl == 2.2.*,     containers == 0.5.*,     these == 0.4.*,-    lens == 4.7.*,     primitive == 0.5.*,-    template-haskell == 2.10.*+    template-haskell >= 2.9 && < 2.11    exposed-modules:     Reflex,@@ -35,7 +35,6 @@     Reflex.Dynamic.TH,     Reflex.Host.Class,     Data.Functor.Misc,-    Control.Monad.TypedId,     Control.Monad.Ref    other-extensions: TemplateHaskell
− src/Control/Monad/TypedId.hs
@@ -1,50 +0,0 @@-{-# LANGUAGE TypeFamilies, FlexibleContexts #-}-module Control.Monad.TypedId ( MonadTypedId (..)-                             ) where--import Data.GADT.Compare-import Data.IORef--import Control.Monad.State-import Control.Monad.Reader--import Unsafe.Coerce-import System.IO.Unsafe--class (Monad m, GCompare (TypedId m)) => MonadTypedId m where-  type TypedId m :: * -> *-  getTypedId :: m (TypedId m a)--nextTypedIdIO :: IORef Int-{-# NOINLINE nextTypedIdIO #-}-nextTypedIdIO = unsafePerformIO $ newIORef 1--newtype TypedId_IO a = TypedId_IO Int deriving (Show)--instance MonadTypedId IO where-  type TypedId IO = TypedId_IO-  {-# INLINE getTypedId #-}-  getTypedId = do-    n <- atomicModifyIORef' nextTypedIdIO $ \n -> (succ n, n)-    return $ TypedId_IO n--instance GCompare TypedId_IO where-  {-# INLINE gcompare #-}-  TypedId_IO a `gcompare` TypedId_IO b = case a `compare` b of-    LT -> GLT-    EQ -> unsafeCoerce GEQ-    GT -> GGT--instance GEq TypedId_IO where-  {-# INLINE geq #-}-  TypedId_IO a `geq` TypedId_IO b = if a == b then Just $ unsafeCoerce Refl else Nothing--instance MonadTypedId m => MonadTypedId (StateT s m) where-  type TypedId (StateT s m) = TypedId m-  {-# INLINE getTypedId #-}-  getTypedId = lift getTypedId--instance MonadTypedId m => MonadTypedId (ReaderT r m) where-  type TypedId (ReaderT r m) = TypedId m-  {-# INLINE getTypedId #-}-  getTypedId = lift getTypedId
src/Reflex/Class.hs view
@@ -6,7 +6,6 @@ import Control.Monad.Identity hiding (mapM, mapM_, forM, forM_, sequence, sequence_) import Control.Monad.State.Strict hiding (mapM, mapM_, forM, forM_, sequence, sequence_) import Control.Monad.Reader hiding (mapM, mapM_, forM, forM_, sequence, sequence_)-import Control.Monad.Writer hiding (mapM, mapM_, forM, forM_, sequence, sequence_, (<>)) import Data.List.NonEmpty (NonEmpty (..)) import Data.These import Data.Align@@ -14,7 +13,6 @@ import Data.GADT.Show (GShow (..)) import Data.Dependent.Sum (ShowTag (..)) import Data.Map (Map)-import qualified Data.Map as Map import Data.Dependent.Map (DMap, DSum (..), GCompare (..), GOrdering (..)) import qualified Data.Dependent.Map as DMap import Data.Functor.Misc
src/Reflex/Dynamic.hs view
@@ -37,13 +37,16 @@                       , unsafeDynamic                       ) where +import Prelude hiding (mapM, mapM_)+ import Reflex.Class import Data.Functor.Misc -import Control.Monad+import Control.Monad hiding (mapM, mapM_, forM, forM_) import Control.Monad.Fix-import Control.Monad.Identity+import Control.Monad.Identity hiding (mapM, mapM_, forM, forM_) import Data.These+import Data.Traversable (mapM, forM) import Data.Align import Data.Map (Map) import qualified Data.Map as Map@@ -68,11 +71,9 @@ hRevApp HNil l = l hRevApp (HCons x l) l' = hRevApp l (HCons x l') +hReverse :: HList l -> HList (HRevApp l '[]) hReverse l = hRevApp l HNil -hEnd :: HList l -> HList l-hEnd = id- hBuild :: (HBuild' '[] r) => r hBuild =  hBuild' HNil @@ -311,19 +312,6 @@   FHNil :: FHList f '[]   FHCons :: f e -> FHList f l -> FHList f (e ': l) -natMap :: (forall a. f a -> g a) -> FHList f l -> FHList g l-natMap f = \case-  FHNil -> FHNil-  h `FHCons` t -> f h `FHCons` natMap f t--sequenceFHList :: Monad m => FHList m l -> m (HList l)-sequenceFHList = \case-  FHNil -> return HNil-  h `FHCons` t -> do-    hResult <- h-    tResult <- sequenceFHList t-    return $ hResult `HCons` tResult- instance GEq (HListPtr l) where   HHeadPtr `geq` HHeadPtr = Just Refl   HHeadPtr `geq` HTailPtr _ = Nothing@@ -359,11 +347,7 @@   rebuildSortedFHList ((WrapArg HHeadPtr :=> h) : t) = FHCons h $ rebuildSortedFHList $ map (\(WrapArg (HTailPtr p) :=> v) -> WrapArg p :=> v) t   rebuildSortedHList ((HHeadPtr :=> h) : t) = HCons h $ rebuildSortedHList $ map (\(HTailPtr p :=> v) -> p :=> v) t --dmapToFHList :: forall f l. RebuildSortedHList l => DMap (WrapArg f (HListPtr l)) -> FHList f l-dmapToFHList = rebuildSortedFHList . DMap.toList--dmapToHList :: forall f l. RebuildSortedHList l => DMap (HListPtr l) -> HList l+dmapToHList :: forall l. RebuildSortedHList l => DMap (HListPtr l) -> HList l dmapToHList = rebuildSortedHList . DMap.toList  distributeFHListOverDyn :: 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 view
@@ -5,7 +5,6 @@  import Language.Haskell.TH import Data.Data-import Control.Monad import Control.Monad.State  -- | 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 view
@@ -5,7 +5,6 @@  import Reflex.Class -import Control.Monad.Identity hiding (mapM, mapM_, forM, forM_, sequence, sequence_) import Control.Monad.State.Strict hiding (mapM, mapM_, forM, forM_, sequence, sequence_) import Control.Monad.Reader hiding (mapM, mapM_, forM, forM_, sequence, sequence_) import Data.Dependent.Sum (DSum)@@ -47,10 +46,10 @@  instance (Reflex t, MonadReflexCreateTrigger t m) => MonadReflexCreateTrigger t (ReaderT r m) where   newEventWithTrigger initializer = do-    r <- ask     lift $ newEventWithTrigger initializer  instance (Reflex t, MonadReflexHost t m) => MonadReflexHost t (ReaderT r m) where   fireEventsAndRead dm a = lift $ fireEventsAndRead dm a   subscribeEvent = lift . subscribeEvent   runFrame = lift . runFrame+  runHostFrame = lift . runHostFrame
src/Reflex/Spider/Internal.hs view
@@ -21,8 +21,6 @@ import Data.Maybe import Data.IntMap (IntMap) import qualified Data.IntMap as IntMap-import Control.Lens hiding (coerce)-import Control.Monad.TypedId import Control.Monad.Ref import Data.Monoid ((<>)) @@ -452,6 +450,7 @@     , rootInit = const $ return $ return ()     } +propagateAndUpdateSubscribersRef :: IORef [WeakSubscriber a] -> a -> EventM () propagateAndUpdateSubscribersRef subscribersRef a = do   subscribers <- liftIO $ readIORef subscribersRef   liftIO $ writeIORef subscribersRef []@@ -829,8 +828,8 @@         parentOcc <- {-# SCC "getMergeSubscribed.a.parentOcc" #-} liftIO $ getEventSubscribedOcc parentSubd         height <- {-# SCC "getMergeSubscribed.a.height" #-} liftIO $ readIORef $ eventSubscribedHeightRef parentSubd         return $ {-# SCC "getMergeSubscribed.a.returnVal" #-} (unsafeCoerce s :: Any, fmap (k :=>) parentOcc, height, WrapArg k :=> parentSubd)-      let dm = DMap.fromDistinctAscList $ catMaybes $ map (^._2) subscribers-          subscriberHeights = map (^._3) subscribers+      let dm = DMap.fromDistinctAscList $ catMaybes $ map (\(_, x, _, _) -> x) subscribers+          subscriberHeights = map (\(_, _, x, _) -> x) subscribers           myHeight =             if any (==invalidHeight) subscriberHeights --TODO: Replace 'any' with invalidHeight-preserving 'maximum'             then invalidHeight@@ -852,7 +851,7 @@             , mergeSubscribedHeight = heightRef             , mergeSubscribedSubscribers = subsRef             , mergeSubscribedSelf = unsafeCoerce $ map (\(x, _, _, _) -> x) subscribers --TODO: Does lack of strictness make this leak?-            , mergeSubscribedParents = DMap.fromDistinctAscList $ map (^._4) subscribers+            , mergeSubscribedParents = DMap.fromDistinctAscList $ map (\(_, _, _, x) -> x) subscribers #ifdef DEBUG_NODEIDS             , mergeSubscribedNodeId = unsafeNodeId m #endif@@ -1278,13 +1277,6 @@   {-# INLINE readEvent #-}   readEvent = liftM (fmap return) . readEvent . unSpiderEvent ---TODO: Can probably get rid of this now that we're not using it for performEvent-instance MonadTypedId EventM where-  type TypedId EventM = TypedId IO-  {-# INLINE getTypedId #-}-  getTypedId = do-    liftIO getTypedId- instance MonadRef EventM where   type Ref EventM = Ref IO   {-# INLINE newRef #-}@@ -1307,7 +1299,8 @@   {-# INLINE hold #-}   hold v0 e = SpiderHostFrame $ R.hold v0 e -newEventWithTriggerIO f= do+newEventWithTriggerIO :: (RootTrigger a -> IO (IO ())) -> IO (R.Event Spider a)+newEventWithTriggerIO f = do   occRef <- newIORef Nothing   subscribedRef <- newIORef Nothing   let !r = Root