diff --git a/src/lib/Qd/Observable.hs b/src/lib/Qd/Observable.hs index 7a034417de29ef14f6536d3f71c76d3862db45d6..66733319f096763fa6d4c58ff40bac166eb75e7f 100644 --- a/src/lib/Qd/Observable.hs +++ b/src/lib/Qd/Observable.hs @@ -121,8 +121,8 @@ instance Settable v (ObservableVar v) where newObservableVar :: Maybe v -> IO (ObservableVar v) -newObservableVar defaultValue = do - ObservableVar <$> newMVar (defaultValue, HM.empty) +newObservableVar initialValue = do + ObservableVar <$> newMVar (initialValue, HM.empty) setObservableVar :: ObservableVar v -> ObservableState v -> IO () setObservableVar (ObservableVar mvar) value = do diff --git a/src/lib/Qd/Observable/ObservablePriority.hs b/src/lib/Qd/Observable/ObservablePriority.hs index a4bd4c45eac53ffec7f13ca9eaa6ae460c8fb3c3..9f180fe1b94846f667f56c9a417dbc1de23f4281 100644 --- a/src/lib/Qd/Observable/ObservablePriority.hs +++ b/src/lib/Qd/Observable/ObservablePriority.hs @@ -57,7 +57,7 @@ currentValue Internals{current} = (\(_, _, value) -> value) <$> current -- | Insert a value with an assigned priority into the data structure. If the priority is higher than the current highest priority the value will become the current value (and will be sent to subscribers). Otherwise the value will be stored and will only become the current value when all values with a higher priority and all values with the same priority that have been inserted earlier have been removed. -- Returns an `RegistrationHandle` that can be used to remove the value from the data structure. -insertValue :: forall p v. (Eq v, Ord p, Hashable p) => ObservablePriority p v -> p -> v -> IO RegistrationHandle +insertValue :: forall p v. (Ord p, Hashable p) => ObservablePriority p v -> p -> v -> IO RegistrationHandle insertValue (ObservablePriority mvar) priority value = modifyMVar mvar $ \internals -> do key <- newUnique newInternals <- insertValue' key internals