diff --git a/auto-update/Control/AutoUpdate.hs b/auto-update/Control/AutoUpdate.hs index 66b348efb..e52f57cf3 100644 --- a/auto-update/Control/AutoUpdate.hs +++ b/auto-update/Control/AutoUpdate.hs @@ -45,9 +45,26 @@ module Control.AutoUpdate ( ) where +import Control.AutoUpdate.Types #ifdef mingw32_HOST_OS import Control.AutoUpdate.Thread #else -import Control.AutoUpdate.Event +import qualified Control.AutoUpdate.Event as Event +import qualified Control.AutoUpdate.Thread as Thread + +import GHC.Event + +mkAutoUpdate :: UpdateSettings a -> IO (IO a) +mkAutoUpdate settings = do + mmgr <- getSystemEventManager + case mmgr of + Nothing -> Thread.mkAutoUpdate settings + Just _m -> Event.mkAutoUpdate settings + +mkAutoUpdateWithModify :: UpdateSettings a -> (a -> IO a) -> IO (IO a) +mkAutoUpdateWithModify settings f = do + mmgr <- getSystemEventManager + case mmgr of + Nothing -> Thread.mkAutoUpdateWithModify settings f + Just _m -> Event.mkAutoUpdateWithModify settings f #endif -import Control.AutoUpdate.Types diff --git a/auto-update/auto-update.cabal b/auto-update/auto-update.cabal index b6601f0c5..1800370cd 100644 --- a/auto-update/auto-update.cabal +++ b/auto-update/auto-update.cabal @@ -21,9 +21,8 @@ library Control.Reaper Control.Reaper.Internal other-modules: Control.AutoUpdate.Types - if os(windows) - other-modules: Control.AutoUpdate.Thread - else + Control.AutoUpdate.Thread + if !os(windows) exposed-modules: Control.AutoUpdate.Internal other-modules: Control.AutoUpdate.Event build-depends: base >= 4.12 && < 5,