summaryrefslogtreecommitdiff
path: root/Reactor/Subscription.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Reactor/Subscription.hs')
-rw-r--r--Reactor/Subscription.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/Reactor/Subscription.hs b/Reactor/Subscription.hs
new file mode 100644
index 0000000..f496f27
--- /dev/null
+++ b/Reactor/Subscription.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE DeriveDataTypeable #-}
+module Reactor.Subscription
+ ( Subscription(..)
+ ) where
+
+import Control.Applicative
+import Reactor.Task
+import Data.Monoid
+import Data.Typeable
+
+-- Like in real life, cancelling a subscription may not stop it from sending you stuff immediately!
+newtype Subscription = Subscription { cancel :: Task () }
+ deriving Typeable
+
+instance Monoid Subscription where
+ mempty = Subscription (return ())
+ Subscription a `mappend` Subscription b = Subscription (a *> b)