{-# LANGUAGE TypeFamilies #-} module PrioritySync.Internal.Prioritized (Prioritized(..)) where import Control.Concurrent.STM -- | Reprioritize a task. This has no effect on a target that has already left the queue. class Prioritized p where type Priority p :: * reprioritize :: p -> (Priority p -> Priority p) -> STM () instance (Prioritized p) => Prioritized (Maybe p) where type Priority (Maybe p) = Priority p reprioritize Nothing = const $ return () reprioritize (Just p) = reprioritize p