Compatibility with GHC 8.2.1
[lsp-test.git] / src / Language / Haskell / LSP / Test / Compat.hs
1 {-# LANGUAGE CPP #-}
2 module Language.Haskell.LSP.Test.Compat where
3
4 import Control.Concurrent.Chan
5 import Control.Monad.IO.Class
6 import Data.Conduit
7
8 #ifdef mingw32_HOST_OS
9
10 import qualified System.Win32.Process as P (getCurrentProcessId)
11 getProcessID :: IO Int
12 getProcessID = fromIntegral <$> P.getCurrentProcessId
13
14 #else
15
16 import qualified System.Posix.Process as P (getProcessID)
17 getProcessID :: IO Int
18 getProcessID = fromIntegral <$> P.getProcessID
19
20 #endif
21
22 #if MIN_VERSION_conduit(1,3,0)
23 chanSource :: MonadIO m => Chan o -> ConduitT i o m b
24 #else
25 chanSource :: MonadIO m => Chan o -> ConduitM i o m b
26 #endif
27 chanSource c = do
28   x <- liftIO $ readChan c
29   yield x
30   chanSource c